如何为通行证发出推送通知 [英] How to make a push notification for a pass
本文介绍了如何为通行证发出推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经开通了传递网络服务。接下来,我需要在更新通行证时发出推送通知。从更新passkit编程指南的传递,它没有详细说明。你能详细解释一下吗?
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.
Passbook有一些特殊注意事项:
There are a few special considerations for Passbook:
- 所有通行证推送请求必须发送到生产APNS服务器(端口2195上的gateway.push.apple.com)
- 您必须使用您的Pass Type ID证书和密钥对APNS服务器进行身份验证(不要使用App APNS证书)
- 无需处理设备注册,只需使用您的Web服务收到的
pushToken
设备注册了通行证 - 有效负载应为空 - 例如
{aps:}
-
alert
,徽章
,声音
和自定义属性键全部被忽略 - 推送的唯一目的是通知Passbook您的网络服务有新的通行证。通知文本将由pass.json中的changeMessage
键以及新旧.pkpass包之间的差异确定 -
changeMessage
字符串应包含%@
如果您希望获得值的内容
要显示的键。否则将显示通用消息 - 从iOS9开始,如果您一次修改多个字段,则锁定屏幕上只会显示一条通用消息。
- 您仍然需要定期查询反馈服务并从数据库中清除过期/无效的pushTokens
- 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. Otherwise a generic message will be displayed - 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
注意推送可以独立于您的Web服务实现更新。 Apple在列表中提供了一些示例Objective-c代码5-1这里。
Note that push updates can be implemented independently of your web service. Apple provide some sample objective-c code in Listing 5-1 here.
这篇关于如何为通行证发出推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文