如何调用pushnotification当服务器需要更新通 [英] How to call pushnotification when server want to update pass

查看:318
本文介绍了如何调用pushnotification当服务器需要更新通的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有更新通的界面。当我点击更新通',我要打电话pushnotification在设备传球。我不知道如何做到这一点。如何做到这一点?

I have an interface for updating pass. When I click 'update pass', I want to call pushnotification to the pass in device. I don't know how to do this. How to do this?

推荐答案

有关存折,不少东西都到位,以便推触发设备上的通知。从表单,您将需要实现的一切遵循这一流程:

For Passbook, quite a few things have to be in place in order for a push to trigger a notification on a device. From your form, you will need to implement everything to follow this flow:


  1. 从表单中的数据发布到你的服务器和数据库更新的合格结果

  2. 检索需要从设备表更新通设备(S)设备pushToken(S)(这些都应该被链接到通表的公共密钥)

  3. 连接到生产APNS使用相匹配的变通
  4. passTypeIdentifier 的PassID证书
  5. 发送包含一个空的有效载荷的APNS消息为每个设备

  6. 等待几秒钟......

  7. 在收到推送,每个设备将使用与您的Web服务<一个href=\"https://developer.apple.com/library/ios/#documentation/PassKit/Reference/PassKit_WebService/WebService.html#//apple_ref/doc/uid/TP40011988\"相对=nofollow>获取序列号与设备关联通行证的方法

  8. 您的Web服务必须与包含更新通的串行(S)(注仅派相关连续的设备,如果您发送未安装合格的串行,您会收到错误日志中的JSON字典回应消息)

  9. 当设备获取的你的回应,它会再次打电话给你的服务的<一个href=\"https://developer.apple.com/library/ios/#documentation/PassKit/Reference/PassKit_WebService/WebService.html#//apple_ref/doc/uid/TP40011988\"相对=nofollow>获取最新的为你发送邮件的串行一个通行证的版本。

  10. 动态生成新的.pkpass包并发​​送与正确的MIME类型和'的Last-Modified头文件
  11. 响应
  12. 提供一个字段值发生了变化,那场字典包含changeMes​​sage键,通知将显示在设备上。如果一切都没有改变,如果没有changeMes​​sage设置,上面也会出现,通将更新,但你不会看到一个通知。

  1. post the data from your form to your server and update the pass record(s) in your database
  2. retrieve the device pushToken(s) for the device(s) that require the updated pass from your devices table (these should be linked to the pass table with a common key)
  3. connect to the production APNS using the PassID certificate that matches the passTypeIdentifier of the changed pass
  4. send an APNS message containing an empty payload for each device
  5. wait a few seconds......
  6. upon receiving the push, each device will contact your web service using the 'Getting the Serial Numbers for Passes Associated with a Device' method
  7. your web service must respond with a json dictionary containing the serial(s) of the updated pass (note only send serials relevant to the device, if you send a serial of a pass that is not installed, you will receive error log messages)
  8. when the device get's your response, it will call your service again with the 'Getting Latest Version of a Pass' for the serial you sent it.
  9. dynamically build the new .pkpass bundle and send as a response with the correct MIME type and 'Last-Modified' header
  10. providing that a field value has changed, and that field dictionary contains a changeMessage key, a notification will show on the device. If nothing has changed, or if no changeMessage is set, the above will still happen, the pass will update but you will not see a notification.

这篇关于如何调用pushnotification当服务器需要更新通的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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