How to make a push notification for a pass
I made a pass web service already. Next, I need to make a push notification when my pass is updated. From Updating a pass of passkit programming guide, it is not in detail. Can you explain this in detail ?
The requirements and protocol for push notifications is documented in the Push Notification Programming Guide.
There are a few special considerations for Passbook:
- All Pass push requests must be sent to the production APNS server (gateway.push.apple.com on port 2195)
- You must use your Pass Type ID certificate and key to authenticate with the APNS server (do not use App APNS certificates)
- There is no need to handle device registrations, you simply use the
pushToken
that your web service received when the device registered the pass - The payload should be an empty - E.g.
{"aps":""}
-
alert
,badge
,sound
and custom property keys are all ignored - the push's only purpose is to notify Passbook that your web service has a fresh pass. The notification text will be determined by thechangeMessage
key in pass.json and the differences between the old and the new .pkpass bundles - The
changeMessage
string should contain%@
if you wish for the content of thevalue
key to be displayed. Change messages may have static text in addition to the%@
variable, such as this:"changeMessage":"New updates: %@"
. If no%@
is provided, a generic message with the kind of pass is displayed:"Store card changed"
. - As of iOS9, if you modify more than one field at a time, only one generic message will be displayed on the lock screen.
- You still need to regularly query the feedback service and purge expired/invalid pushTokens from your database
Note that push updates can be implemented independently of your web service. Apple provide some sample objective-c code in Listing 5-1 here.