ios - PKPassLibrary containsPass return wrong value -


i add pkpass library through pkaddpassesviewcontroller. pass visible in passbook app.

the following code called:

nsdata *data = [nsdata datawithcontentsoffile:filepath]; nserror *error;  //init pass object data pkpass *pass = [[pkpass alloc] initwithdata:data error:&error];  if([self.passbooklibrary containspass:pass]) { 

passbooklibrary not nil.

containspass returns yes on ios7

containspass returns no on ios6

there 2 types of pkpass. pklocalpass , pkremotepass. above created pkpass pklocalpass. check works pkremotepass. can obtain function:

- (pkpass *)passfromlibraryfrompkpass:(pkpass *)pass {     if (system_version_less_than(@"7.0")) {         pkpass *librarypass = [self.passbooklibrary passwithpasstypeidentifier:pass.passtypeidentifier serialnumber:pass.serialnumber];         return librarypass;     } else {         return pass;     } } 

furthermore, provisioning profile must passbook enabled. created new profile app id contains pass type identifier.

ios 7 nice in context. works.


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -