PKPassLibrary not removing pass

Published

I am implementing apple in-app provisioning and I am able to add a credit card to apple wallet via my app for iPhone and Watch.
and I am able to get all these passes and work with them … but when I want to delete one of them nothing happened

this is how I playing with deleting

... 
 let passLib = PKPassLibrary.init();

   let passesTest = passLib.passes();
   let passToRemove = passesTest[0];
   passLib.removePass(passToRemove)
...

passLib.passes(); return all passes that I have in the wallet and are relevant to my app I select one and try to remove it … but nothing happened. The pass is still there also the card is still in the wallet

any advice?

UPDATE

I should have entitlements right because I am able to add card to wallet this is a list of entitlements:
enter image description here

this is logic that I want to implement … it is a React-Native module:

      @objc
  func removePass(_ data: NSDictionary, resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
        
    let passTypeIdentifier = data["passTypeIdentifier"] as! String
    let serialNumber = data["serialNumber"] as! String

    
   let passToRemove = passLib.pass(withPassTypeIdentifier: 
   passTypeIdentifier, serialNumber: serialNumber)



      passLib.removePass(passToRemove)
      resolve(true)

  }

and the passes what I get from passLib.passes(); looks like this

<PKPaymentPass: 0x10611eba0>

(to be readable I had to stringify it)

[ { localizedName: 'Pass',
    serialNumber: 'nc.prod.cert_efdeb2c6048c468ba6a941a063ce4345',
    passURL: 'shoebox://card/Nc4q8dwnXB1CGYG-YQRH4bIdhO4=',
    deviceName: 'iPhone',
    passType: 1,
    organizationName: 'Name Bank',
    localizedDescription: 'Name Mastercard Gold',
    isRemotePass: false,
    relevantDate: null,
    authenticationToken: null,
    webServiceURL: null,
    passTypeIdentifier: 'paymentpass.com.apple' } ]

Source: Ios Questions

Published
Categorised as apple-wallet, ios, ios-provisioning, passbook, swift Tagged , , , ,

Answers

Leave a Reply

Your email address will not be published. Required fields are marked *

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq