如何为通行证制作推送通知 [英] How to make a push notification for a pass

查看:32
本文介绍了如何为通行证制作推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个 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:

  1. 必须将所有 Pass 推送请求发送到生产 APNS 服务器(端口 2195 上的 gateway.push.apple.com)
  2. 您必须使用您的 Pass Type ID 证书和密钥向 APNS 服务器进行身份验证(不要使用 App APNS 证书)
  3. 无需处理设备注册,您只需使用设备注册通行证时 Web 服务收到的 pushToken
  4. 有效载荷应该是空的 - 例如{"aps":""}
  5. alertbadgesound 和自定义属性键都被忽略 - 推送的唯一目的是通知 Passbook 您的网络服务已一个新鲜的传球.通知文本将由 pass.json 中的 changeMes​​sage 键以及新旧 .pkpass 包之间的差异决定
  6. changeMes​​sage 字符串应包含 %@ 如果您希望显示 value 键的内容.除了 %@ 变量之外,更改消息可能还有静态文本,例如:"changeMes​​sage":"New updates: %@".如果未提供 %@,则会显示带有通行证类型的通用消息:"Store card changed".
  7. 从 iOS9 开始,如果您一次修改多个字段,则锁定屏幕上只会显示一条通用消息.
  8. 您仍然需要定期查询反馈服务并从数据库中清除过期/无效的 pushToken
  1. All Pass push requests must be sent to the production APNS server (gateway.push.apple.com on port 2195)
  2. You must use your Pass Type ID certificate and key to authenticate with the APNS server (do not use App APNS certificates)
  3. There is no need to handle device registrations, you simply use the pushToken that your web service received when the device registered the pass
  4. The payload should be an empty - E.g. {"aps":""}
  5. 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 the changeMessage key in pass.json and the differences between the old and the new .pkpass bundles
  6. ThechangeMessage string should contain %@ if you wish for the content of the value 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".
  7. As of iOS9, if you modify more than one field at a time, only one generic message will be displayed on the lock screen.
  8. You still need to regularly query the feedback service and purge expired/invalid pushTokens from your database

请注意,推送更新可以独立于您的 Web 服务实施.Apple 在 Listing 中提供了一些示例 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆