通过 Urban Airship 向 Passbook 推送通知未出现在设备上 [英] Push notifications to Passbook via Urban Airship not appearing on device

查看:29
本文介绍了通过 Urban Airship 向 Passbook 推送通知未出现在设备上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现这篇文章对设置非常有帮助,但我还没有看到推送通知在安装了通行证的 iPhone 上出现.

I've found this post to be really helpful in getting set up, but I have yet to see the push notification come through on the iPhone on which the pass is installed.

Passkit-push-notification-not-working-with-urban-airship

我在城市飞艇的网站上设置了我的应用程序,并将其推送到 Apple 的开发服务器.我在我的手机上安装了一个 pass 并运行我在上面的帖子中找到的以下命令:

I set up my app on urban airship's site pushing to Apple's development servers. I installed a pass on my phone and run the following commands which I found in the above post:

airship = urbanairship.Airship(_UrbanAirshipPassbookKey, _UrbanAirshipPassbookMasterSecret) 
airship.push({'aps': {'alert': 'Go.'}}, device_tokens=tokens)

然后我在 Xcode 的 iPhone 控制台窗口中看到了此推送的确认.

I then see confirmation of this push in the iPhone console window in Xcode.

Received push for topic pass.xxx.xxx: {
    ...
    aps =  {
        banner = "Hello";
    };

然后 iPhone 将其更新标签连同其传递类型 ID 和设备库 ID 发送回 Web 服务.此时,Web 服务应该发回已更改通行证的列表.但是,我看到以下错误消息:

and the iPhone then sends its update tag back along with its pass type ID and Device Library ID to the web service. At this point the web service is supposed to send back a list of changed passes. However, I instead see the following error message:

<Warning>: Web service error for pass.mypasstype.id (http://192.168.30.209:8000): Response to 'What changed?' request included 1 serial numbers but the lastUpdated tag (2013-02-11T17:25:25) remained the same.

有谁知道为什么会这样?我是否需要实际修改传递中的字段才能在设备上显示推送通知?

Does anyone know why this is happening? Do I need to actually modify a field in the pass to get the push notification to appear on the device?

推荐答案

对您的问题的简短回答是肯定的,您确实需要修改传递中的字段以获取要显示的推送通知.这是因为,与应用推送不同,Passbook 推送负载不决定通知的内容.

The short answer to your question is yes, you do need to modify a field in the pass to get a push notification to show. This is because, unlike with app pushes, a Passbook push payload does not determine the content of the notification.

Passbook 推送消息的目的是提醒设备 Web 服务有一个包含更新内容的新通行证.警报文本仅由新通行证内容确定.推送负载中的任何内容都将被忽略.Apple 建议 带有空 JSON 字典的推送通知.

The purpose of a Passbook push message is to alert the device that the web service has a new pass with updated content. The alert text is determined solely by the new pass contents. Any content in the push payload is ignored. Apple advise a push notification with an empty JSON dictionary.

发送推送后,会触发以下链:

Once a push is sent, it triggers the following chain:

  • 设备通过passTypeIdentifierlastUpadted标签接收推送和查询网络服务
  • Web 服务为所有带有 passTypeIdentifier 的通行证提供了一个序列列表,这些通行证自 lastUpdated 标记以来发生了变化
  • 设备接收序列号并请求网络服务为每个新的pass 发送新的.pkpass 包
  • Web 服务发送新的 .pkpass 包
  • 设备接收 .pkpass 包并对照旧通行证检查更改
  • 如果满足以下条件,设备将显示 changeMes​​sage 键中提供的通知:
    • 值已更改
    • changeMes​​sage 包含 %@ 字符串
    • Device receives push and queries web service with the passTypeIdentifier and lastUpadted tag
    • Web service provides a list of serials for all passes with the passTypeIdentifier that have changed since the lastUpdated tag
    • Device receives serial(s) and requests the web service to send the new .pkpass bundle for each new pass
    • Web service send the new .pkpass bundle
    • Device receives the .pkpass bundle and checks it against the old pass for changes
    • If the following criteria are met, the device will display the notification provided in the changeMessage key:
      • The value has changed
      • The changeMessage contains the %@ string

      Id %@ 字符串不存在,pass 将显示通知 Pass Changed.如果更改后的值没有 changeMes​​sage 键,则不会显示任何消息.

      Id the %@ string is not present, the pass will show a notification Pass Changed. If no changeMessage key is present for the changed value, no message will show.

      这篇关于通过 Urban Airship 向 Passbook 推送通知未出现在设备上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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