Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8640139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:12:26+00:00 2026-06-12T11:12:26+00:00

How would I generate a Pass on my web server, then download it in

  • 0

How would I generate a Pass on my web server, then download it in Xcode.
On xcode, I am trying to generate a pass then add it to my passbook wallet. Code:

NSString* passFile = @"http://pass.keatonburleson.com/gen.php?name=128keaton";

//3
NSData *passData = [NSData dataWithContentsOfFile:passFile];

//4
NSError* error = nil;
PKPass *newPass = [[PKPass alloc] initWithData:passData
                                         error:&error];
//5
if (error!=nil) {
    [[[UIAlertView alloc] initWithTitle:@"Passes error"
                                message:[error
                                         localizedDescription]
                               delegate:nil
                      cancelButtonTitle:@"Ooops"
                      otherButtonTitles: nil] show];
    return;
}

//6
PKAddPassesViewController *addController =
[[PKAddPassesViewController alloc] initWithPass:newPass];

   [self presentViewController:addController
                   animated:YES
                 completion:nil];

So basically, my error is ‘trace’ and crashes.
Update: Thanks to Caleb, no more trace error!
Unfortunately, i get a ‘Pass isnt valid error!’ 🙁
Latest and updated code:

    NSString* passFile = @"http://pass.keatonburleson.com/gen.php?name=128keaton";
 NSURL *url = [NSURL URLWithString:passFile];
//3
NSData *passData = [NSData dataWithContentsOfURL:url];

//4
NSError* error = nil;
PKPass *newPass = [[PKPass alloc] initWithData:passData
                                         error:&error];

BG Info:

My webserver contains a PHP script which generates a passkit pass and displays it for download like a PkPass. If you are on a mac or iPhone you can go to the passFile URL and it will display a valid pass. I think my issue is it is trying to download a linked file when it really generates it an automatically downloads it. I might need to edit some server code to not destroy the ‘saved’ pkpass on my webserver. But, I would rather not do that.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T11:12:27+00:00Added an answer on June 12, 2026 at 11:12 am

    You should probably be using -dataWithContentsOfURL: since that’s what you’re providing. Is passData == nil after the second line? If yes, that may be your problem.

    Note: The PKPass docs say that you should check the console for details if you gt an error from -initWithData:error:, so look there and let us know what you find.

    Update:

    My webserver contains a PHP script which generates a passkit pass and
    displays it for download like a PkPass. If you are on a mac or iPhone
    you can go to the passFile URL and it will display a valid pass.

    Unless your server is detecting the client and deciding what to send back based on that, it’s not likely that the same URL that displays the pass returns the pass file itself. Look at the contents of the data you receive and see if its a valid pass. If not, you’ll need to adjust your server or use a different URL.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to call a Soap Web Service, and I need to pass an
Why would this if 1 \ and 0: pass simplest of code choke on
Can anyone tell me why this would generate a syntax error in Safari and
i am making a module which would generate and transmit ip packets for voice.
I need to create a simple application that would generate reports based on database
I was wondering if there was a software that would generate UML class diagrams
I vaguely remember some sort of setuptools wrapper that would generate .egg files from
Most of us know that the command random.randint(1,n) in Python (2.X.X) would generate a
How would i generate a file of all of the following types: .js .css
How would I generate automatic bindings for a C project that is built using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.