Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your code in it's current state does not make a call to <code>PKAddPassesViewController</code> to present the pass to the user.</p> <p>Assuming that the Pass Library is available, the following works with the url you provided in iOS6 &amp; iOS7:</p> <pre><code>NSData *data = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:kAPIPass]]; if (nil != data) { PKPass *pass = [[PKPass alloc] initWithData:passData error:&amp;error]; if(error) { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"OK"otherButtonTitles:nil]; [alertView show]; } else { PKAddPassesViewController *pkvc = [[PKAddPassesViewController alloc] initWithPass:pass]; pkvc.delegate = self; [self presentViewController:pkvc animated:YES completion:^{ // Do any cleanup here } ]; } } </code></pre> <p>Alternatively, you could load it asynchronously so as not to block the main thread.</p> <pre><code>[NSURLConnection sendAsynchronousRequest:_request queue:_browser completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) { if (nil != error) { // handle error } else if (nil != data) { PKPass *pass = [[PKPass alloc] initWithData:passData error:&amp;error]; if(error) { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"OK"otherButtonTitles:nil]; [alertView show]; } else { vc = [[PKAddPassesViewController alloc] initWithPass:pass]; pkvc.delegate = self; [self presentViewController:pkvc animated:YES completion:^{ // Do any cleanup here } ]; } } }]; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload