Nirma
Nirma

Reputation: 5790

Programmatically create pass for passkit on device?

I am trying to find a way to generate a pass for passkit on the device its self after it received the information to put in a pass over the network.

Does anyone know if this can be done / how to do this?

Upvotes: 8

Views: 6930

Answers (2)

WDUK
WDUK

Reputation: 19030

Refer to: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/PassKit_PG/YourFirst.html#//apple_ref/doc/uid/TP40012195-CH2-SW1

Basically: Not easily (if at all), you need to be able to sign your pass using signpass, a command line utility in order to make it readable by devices. This will cause a lot of hassle and distress, as you can't run another process on iOS, and to convert the signpass code to run on the device might not be possible either.

What I would suggest is to sign your pass on the server/wherever the data is coming from, and send both the information and the generated .pkpass to the device. This is how it was designed, and how it should be used. Read the docs for more information, they're very clear.

Upvotes: 8

ptz0n
ptz0n

Reputation: 481

Actually, Apple have stated the security problems when signing passes in iOS. This is because the certificates needs to be packaged with the app. And you don't want to expose certificates to users like that.

Just like WDUK suggests, implement a simple pass signing and distribution server that your app can request passes from. This is also very helpful when you want to update passes added to devices.

I'm sure you can find a server implementation that fits your needs on GitHub.

Upvotes: 4

Related Questions