Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passbook Integration iOS (Dynamically)

I want to integrate Passbook into my coupons app.

I was following this tutorial: http://www.raywenderlich.com/20734/beginning-passbook-part-1

We know for adding a pass we need to first create a .pkpass file. I am able to create a .pkpass file manually for adding a pass to passbook.

I have created the .pkpass file by creating pass.json, signature, manifest.json, and all.

But my real doubt is: How to create a .pkpass file dynamically - if I have coupons like this in the table view (see image), when I click on on "Add to passbook", I will provide necessary info and it will create a .pkpass file for that cell.

How can this be done?

Screenshot

How can I create a .pkpass file for a particular cell on click of an "Add to passbook" button?

like image 377
Krunal Avatar asked Sep 11 '14 08:09

Krunal


2 Answers

Because passes have to be signed using a private key, .pkpass files must be created on a server. In addition, Apple specifies a REST interface that should be implemented by your server to push and handle updates to these passes.

I don't know the details of your project, so you will have to decide what makes sense to you before you proceed to the next step. If you have a server that manages these coupons with a database and backend, you should implement the web interface Apple specifies to build and sign your apps. If your coupons are relatively simple, you could consider using a third party service to build your passes. They will have APIs as well as tools to design your passes to make everything easier. You will have to do some research yourself but with a quick google search I found PassSlot and PassKit.

If you decide to implement it yourself you should read Apple's documentation on how the web service works and come back with a more specific question. (related to a framework, programming language, etc...)

like image 101
Asa Avatar answered Sep 21 '22 03:09

Asa


We need to use web services to get pass data and convert it into PKPasses on our side. Then use PKAddPassesViewController to add pass on your device.

like image 40
jain aanchal Avatar answered Sep 25 '22 03:09

jain aanchal