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

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

问题描述

我已经开通了传递网络服务。接下来,我需要在更新通行证时发出推送通知。从更新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. 所有通行证推送请求必须发送到生产APNS服务器(端口2195上的gateway.push.apple.com)

  2. 您必须使用您的Pass Type ID证书和密钥对APNS服务器进行身份验证(不要使用App APNS证书)

  3. 无需处理设备注册,只需使用您的Web服务收到的 pushToken 设备注册了通行证

  4. 有效负载应为空 - 例如 {aps:}

  5. alert 徽章声音和自定义属性键全部被忽略 - 推送的唯一目的是通知Passbook您的网络服务有新的通行证。通知文本将由pass.json中的 changeMes​​sage 键以及新旧.pkpass包之间的差异确定

  6. changeMes​​sage 字符串应包含%@ 如果您希望获得值的内容要显示的键。否则将显示通用消息

  7. 从iOS9开始,如果您一次修改多个字段,则锁定屏幕上只会显示一条通用消息。

  8. 您仍然需要定期查询反馈服务并从数据库中清除过期/无效的pushTokens

  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. Otherwise a generic message will be displayed
  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在列表中提供了一些示例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天全站免登陆