Downloading PKPass in an iOS custom app from my server
- by taurus
I've setup a server which returns a PKPass. If I copy the URL to the browser, a pass is shown (both in my Mac and in my iPhone).
The code I'm using to download the pass is the following one:
NSData *data = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:kAPIPass]];
if (nil != data) {
    PKPass *pass = [[PKPass alloc] initWithData:data error:nil];
    PKAddPassesViewController *pkvc = [[PKAddPassesViewController alloc] initWithPass:pass];
    pkvc.delegate = self;
    [self presentViewController:pkvc
                       animated:YES
                     completion:^{
                         // Do any cleanup here
                     }
     ];
}
Anyway, when I run this code I have the following error:
  * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Only support RGBA or the
  White color space, this method is a hack.'
I don't know what is the bug... The pass seems ok when I download it with Safari and even the code seems ok (there are just 3 simple rows...) Someone experienced with Passkit could help me?
EDIT: the weird thing is that the exact same code is working in a fresh new project