is it possible to develop pass creator? - ios

i investigate development for Apple Passbook. i've found that if you have something to perform as a pass to your subscribers, you should create special .pkpass files and distribute them variously. But is it possible to create your own passes in iOS application and add them to Passbook? For example, i have barcode, all additional info, so i want application user to configure his own pass.

It's certainly technically possible to develop your own pass creation App, however to create a .pkpass bundle entirely within an App would require you to embed your Pass ID Private Key within the App which presents a huge security risk.
In practice, your App should send the pass data to your web server which should compile the .pkpass bundle and transfer the bundle back to your App to add to Passbook.
The Apple Pass Kit Framework reference gives you everything you need to accept a pass from your web server that contains info that your user has provided to your App.

Related

Ios Custom apps and Mdm

I have a custom app on the app store. I will assign it to a clients apple business manager account. Does that client have the ability to be able to send configuration changes (for instance if they want to change a url that the app is connecting to) through their existing mdm to my custom app? Would there be any other setup I would have to do in my custom app besides reading the IOS userdefaults that the mdm server sets? Thanks in advance.
If the client's MDM supports AppConfig then it can supply an XML file that contains specific settings. The contents of this XML file are merged with UserDefaults for your app on the device and your app can access them at runtime.
You need to create the logic in your app so that it uses these values when present and standard values if they are not.

Creating passbook passes in iOS app

Is it possible to create pkpass in app? I have watched a few wwdc and searched online. It say it require signing and it can't be created in app. Is it correct? If not, is there a way to create in app?
The simple answer is yes, but you probably don't want to. I don't see what would stop you creating and signing a PKPass file in ObjectiveC or Swift.
The reason you wouldn't want to do this is security. When a pass is created, it's manifest is signed with a private key. This ensures that you can trust the vendor and it also provides legal safeguards. If you put were to create the private key into the pass it could be extracted and use to create similar Passes or even replace your own passes.

how to add passes that get dynamic info from my app to wallet from in swift?

I created the my own .pkpass file with dummy data
I need to change the data in the pass according to the data in the app
like boarding pass
if I missed something , could please help me ?
You will require a new .pkpass bundle for every change to the pass.
A new bundle will need to be signed. For security reasons, this should not take place on the device as it risks compromising your Pass Type ID certificate.
When you want to change the data, you should request a new pass bundle from your server and use the PassKit APIs to replace the pass in the Wallet.
You need to implement full loop system according to Apple Passbook/wallet standard or at least you have to like this.
in pkpass file add webService, serialNumber (text and number), authenticationToken (text and number at least 16 characters), passTypeIdentifier and teamIdentifier value (register and download certification file from apple developer account). It has to be https and point to your server.
create push notification system to devices that keep your passes by using certification file (cer) and create p12 and pem files (you can find how to make it here: Update Passbook wallet failed to connect)
create update web service to manage request from device and return new pkpass file to devices
others that: you have to make web service to manage register, update and delete method from devices.

Prevent installing passbook on multiple devices

Not exactly a programming question but here it goes:
How can a company who is distributing passbook passes via email or web prevent a pass from being installed on more than one device?
I can not find anything about this on Apple docs. The only I can think of is to check on the device registration webservice whether the combination of pass type and serial has a device already registered and delete it , but I am not aware of any command to delete the pass remotely.
Another option would be to check if it is already registered prior to generating the pass but this would only work for URL distribution, not for email.
Is there any way to delete a pass remotely via push notification + update? Any ideas on how to solve this issue?
Mail and Mobile Safari will present any pass they are given and the user can decide to add them to their Passbook. There is nothing the pass creator can do to prevent it except to be careful about how the .pkpass files get handed around.
If you really only want to deliver a specific pass to a specific device you might consider a companion app that uses a custom API to communicate with the the backend and request the pass for that device that way. Then you have much more control than distribution via email or url links.
Apple frowns on trying to delete a pass programmatically; only users are supposed to delete passes because they added them. You can, however, update a pass to make it clear that is not valid and should be deleted. For example you can remove the bar code, if any, and use a background image with a big red "INVALID" on it.
Just to extend #ohmi's answer:
You cannot prevent passes from being installed on more than one
device - e.g. if user enables iCloud for Passbook, the passes will get
synced automatically across devices.
Considering your links to pkpasses are public, you may want to consider
introducing one-time download links, but while it can fill your
needs just fine, users can be really disappointed if it's impossible to re-add
passes that they manually deleted. So I wouldn't recommend such solution.
You can make you pkpass links kind of private, so only GET request originating from your application and carrying a specific value for specific header field (e.g. auth_token), will receive a pkpass file, however this way you almost disable pass distribution via email or via sharing URLs to passes and make pass updating probably impossible.

App submittion from clients side

I am developing an application which is going to be branded to for different clients. For some clients I will release the application myself using my developer account # apple, but some clients want to release the application using their own developer account.
Off course they can create an account for me which I can build the application with, or I could give them the source code of my application and let them do it them selfs.
BUT, what if I want to do neither of those solutions? Is there some way that I could build the application on my computer for the client with maybe the Bundle identifier that doesn't exist yet? (e.g. com.somecompany.appName)?
I am skeptic to "give" away my source code to the client.
How can I share my app with the client without sharing the source code?
If the client has an Intel Mac and an iOS developer account, then one common way to do this is to put your app's code mostly inside a static shared library, with a few pages of wrapper code to start it. Then give the client an Xcode project containing the library object code (of your "secret" ingredients) plus the public wrapper source code. The client can launch Xcode, select their Distribution provision, hit build, then submit the results.
This technique optionally also allows the client to modify icons, appIDs, etc., but still not see the source to your shared library.
Why don't you use the login provided by your client to do it yourself without giving away your source code. Or just request a distr cert en sent a zip back to your client.
It helps to have all your information ready. Appstore Submitting Template I use. http://loughnanedevelopment.blogspot.com/2010/08/app-store-submitting-template.html

Resources