php - 苹果推送通知问题

标签 php ios zend-framework push-notification apple-push-notifications

我真的不知道如何问这些问题,但希望我能让自己足够清楚,让您理解我的问题

  1. 消息限制为 256。但是我需要对哪条消息施加此限制? 起初我以为它指的是 json 大小。但是在查看了 zend 使用的代码以及其他使用推送通知的代码后,附加信息是通过有效负载发送的(json 是 256,但发送的有效负载是 270)。我应该将 json 限制为 240 或更少吗?

  2. 如果多条消息具有相同的 ID(我不是在谈论设备 ID),会发生什么

  3. 向同一设备发送第二条消息的速度有多快?我遇到了一些问题,只有一条消息到达。

我使用时间戳作为 Id,所以我想知道这是否是我的问题的原因,或者也许我无法在同一秒内向单个设备发送 5 条消息。

最佳答案

来自Apple Developer site :

The Notification Payload

Each push notification includes a payload. The payload contains information about how the system should alert the user as well as any custom data you provide. The maximum size allowed for a notification payload is 256 bytes; Apple Push Notification Service refuses any notification that exceeds this limit.

限制是完整的有效负载,即 JSON + 您的消息。因此,您的消息应限制为 236 个字符,然后添加以下 JSON 的字符数:{"aps":{"alert":""}}

how fast can i send a second message to the same device? I have some problems that only 1 message arrives.

向一台设备发送消息没有限制。但是,Apple 不保证传送您的所有消息,如果从一个应用程序收到发往同一设备的多条消息,APNS 可能仅传送该设备的最新推送通知消息。

来自iOS Developer Library :

Some Notifications Received, but Not All

If you are sending multiple notifications to the same device or computer within a short period of time, the push service will send only the last one.

Here's why. The device or computer acknowledges receipt of each notification. Until the push service receives that acknowledgment, it can only assume that the device or computer has gone off-line for some reason and stores the notification in the quality of service (QoS) queue for future redelivery. The round-trip network latency here is of course a major factor.

As described in the Local and Push Notification Programming Guide, the QoS queue holds a single notification per app per device or computer. If the service receives another notification before the one in the queue is sent, the new notification overwrites the previous one.

感谢 Joachim Isaksson用于提供上述链接。

关于php - 苹果推送通知问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16960855/

相关文章:

ios - 我可以在 App Store 上发布比以前更低的版本吗?

zend-framework - DataMapper 模式会破坏 MVC 吗?

zend-framework - Zend 框架 : Post to different action then return to original action if fails validation AND keep form fields

php - 显示过去 30 天的表格数据

php - 如何对大数使用 rand()

PHP foreach 多次执行代码

ios - 这个地理定位计算有多准确?

ios - 使用 AWS S3 上传文件在 Flutter 中返回空字符串

php - 可以在运行时在 php 中将函数分配给类变量吗?

php - 如何根据潜在客户 'Campaign' 子面板中的信息在 SugarCRM/SuiteCRM 中创建逻辑 Hook ?