2

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' } ]

UPDATE I also try to remove this card from the Testflight version and it doesn't work... remove function return nothing

Lukáš Šálek
  • 1,265
  • 2
  • 19
  • 38
  • It's a very naive start, but are the entitlements in your Xcode project configured correctly? I assume yes since you were able to add a pass... Maybe you should try writing a piece of code outside of your business logic. This code would add a new pass and try to remove it immediately. Maybe this will help you figure out the problem... – Isaaс Weisberg Sep 29 '21 at 07:29
  • I just add more info info my questions – Lukáš Šálek Sep 29 '21 at 07:44

0 Answers0