I am writing the server part of a Passbook implementation. The Passbook "card" will be static and not change. Do I really have to use a server to compile the pkpass file?

Reason I ask is that in the sample project Apple has then they have Objective-C code to create and sign a Passbook. If I am only going to use a static card that will not update then I see no point in compiling the pkpass on the server when I can do it locally in the app.

有帮助吗?

解决方案

If the pass is truly static, I.e. it does not contain the webServiceURL or authenticationToken keys and does not contain variable data provided by the user, then you do not require a server.

You still need to create and sign the pass, but this can be done with the command line tool that Apple provide.

Once you have your .pkpass bundle, you can either add the signed .pkpass bundle to your app bundle, or post it to a web server or CDN (E.g. Amazon S3). To add it to the users Passbook from within your app, retrieve it from your app bundle or external URL then pass it to a PKAddPassesViewController.

Personally, I would opt for posting the .pkpass bundle somewhere online because it will allow you to change the pass without having to resubmit the app.

Compiling a .pkpass from within an app is a very bad idea. Your app may not be approved because to sign from within your app requires you to embed your Pass Type ID private key within your app bundle.

If you need to incorporate unique user info within a pass, then this will almost certainly require you to build a server, or use a service provider, since every pass will still need to be built and signed to order.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top