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..
-
Does you App have permissions to access the passTypeIdentifier?PassKit– PassKit2013年03月05日 07:03:22 +00:00Commented Mar 5, 2013 at 7:03
-
Not sure - how are these permissions set?Wayne Conn3cted– Wayne Conn3cted2013年03月05日 23:02:04 +00:00Commented 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?Wayne Conn3cted– Wayne Conn3cted2013年03月07日 05:52:36 +00:00Commented 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 entitlementsWayne Conn3cted– Wayne Conn3cted2013年03月07日 06:02:22 +00:00Commented Mar 7, 2013 at 6:02
-
1If 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.Alex Martini– Alex Martini2013年03月07日 06:44:37 +00:00Commented Mar 7, 2013 at 6:44
1 Answer 1
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.