2

I've hit an issue that I just cannot solve. We have an app that can store cards, these cards can be added to the passbook on iOS. We have no problems with this. However when we need to update the card in the passbook we cannot retrieve the card from the passbook - we always get nil returned. However on the simulator it always works.

This is how I am calling

_passLib = [[PKPassLibrary alloc] init];
NSString* serialId = [[NSString alloc] initWithFormat:@"%@", card.serialId];
PKPass *oldPass = [_passLib passWithPassTypeIdentifier:@"pass.com.mydomain.iphone.Product" serialNumber:serialId];

The identifier and serial id are 100% correct. When adding the card I output these values to double check they are the same as above. Has anyone had this or has some ideas that can help me solve this? many thanks

Edit 1 Just to add. If I try and add the pass again - the PKAddPassesViewController displays the new pass but the 'Add' button is greyed out because we already have the pass added. So its like it knows its there, but the methods containsPass and passWithPassTypeIdentifier both fail..

6
  • Does you App have permissions to access the passTypeIdentifier? Commented Mar 5, 2013 at 7:03
  • Not sure - how are these permissions set? Commented Mar 5, 2013 at 23:02
  • The app itself is adding the pass to Passkit. We use the same passTypeIdentifier for both. It also matches what we have in the entitlement file. What else are we missing? Commented Mar 7, 2013 at 5:52
  • I also notice that containsPass does not work either on the devices either (ok on the simulator), and looking at the documentation you don't even need the entitlements Commented Mar 7, 2013 at 6:02
  • 1
    If the containsPass method tells you that the pass isn't on the device, you should start by making sure that the pass was actually added to the pass library. Open the Passbook app and make sure it's actually there. Passes aren't validated until you try to add them, so even though it displays on the device, it might not actually add. Check the console log (Xcode device organizer) for more info if it's not valid. Commented Mar 7, 2013 at 6:44

1 Answer 1

2

Ok finally figured it out. I needed to configure my App Id in the development center and enable 'passes'. I then have to generate a new provisioning profile and use that.

answered Mar 10, 2013 at 23:39
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.