I’m creating app in which I’m adding and showing passes from passbook app of iOS6 to my app. But when I run application on simulator it’s showing added passes but when I run same on Device it’s showing that my passbook is empty.
I have followed iOS6 tutorial integrating passbook your applications link for creating, adding and showing passes.
for accessing passes I have used following code –
NSArray * passArray = [_passLib passes];
NSLog(@"number of passes in library are: %d",[passArray count]);
//if more tha one pass in library, just use the first one.
if ([passArray count] > 0)
{
for (int i = 0; i<[passArray count]; i++)
{
PKPass *onePass = [passArray objectAtIndex:i];
//access general fieldnames
NSLog(@"%@",[onePass localizedName]);
NSLog(@"%@",[onePass organizationName]);
//access a specific field name
NSLog(@"%@",[onePass localizedValueForFieldKey:@"rewards"]);
}
}
Do we need to make any changes if we run app on device to support passbook integration?
Create AppId which is similar to passTypeIdentifier. For example if your passTypeIdentifier is pass.abc.xyz then your AppId must be com.abc.xyz .While creating provisioning profile make use of this appId and make use of this provisioning profile for your app. Then only you will be able to distinguish passes available in your passbook.