推送通知在被删除之前排队等待多长时间?

时间:2023-01-14 08:06:59

I've been digging around trying to uncover some data for apple's push notifications for a client and something I have been unable to find an answer to is how long a push notification will sit in queue for an offline device before it will be removed.

我一直在努力为客户端发现苹果推送通知的一些数据,而我无法找到答案的是推送通知在被删除之前将多长时间排在队列中。

There maybe long periods of time, 2-3 months for example, in which the device maybe inactive and powered off. I'm simply interested in knowing how long I can expect a notification to linger, waiting to be delivered to an offline device, before it gets automatically removed (which is what I understand to be what happens).

可能有很长一段时间,例如2-3个月,其中设备可能处于非活动状态并且断电。我只是想知道在自动删除通知之前我可以期待一段时间可以延迟,等待传递到离线设备(这是我理解的情况)。

2 个解决方案

#1


17  

Official developer documentation isn't clear about this. From developer.apple.com:

官方开发者文档不清楚这一点。来自developer.apple.com:

Apple Push Notification Service includes a default Quality of Service (QoS) component that performs a store-and-forward function. If APNs attempts to deliver a notification but the device is offline, the QoS stores the notification. It retains only one notification per application on a device: the last notification received from a provider for that application. When the offline device later reconnects, the QoS forwards the stored notification to the device. The QoS retains a notification for a limited period before deleting it.

Apple推送通知服务包括执行存储转发功能的默认服务质量(QoS)组件。如果APN尝试发送通知但设备处于脱机状态,则QoS会存储通知。它在设备上每个应用程序仅保留一个通知:从该应用程序的提供程序收到的最后一个通知。当离线设备稍后重新连接时,QoS将存储的通知转发到设备。 QoS会在删除之前保留有限时间段内的通知。

But according to PCWorld, it's 28 days:

但根据PCWorld,它是28天:

If the app is running, it gets the notification immediately. If the app isn't running, the notification is held in the phone to be consumed at the app's next launch. If the iPhone is offline when the sender attempts delivery, APNS attempts to send the notification for 28 days.

如果应用程序正在运行,它会立即收到通知。如果应用程序未运行,通知将保留在手机中,以便在应用程序下次启动时使用。如果iPhone在发件人尝试发送时处于脱机状态,则APNS会尝试将通知发送28天。

While 28 days may have been true in 2009, I wouldn't be surprised if its different today. The ambiguity in the documentation is a great excuse for Apple to change this timeout period willy-nilly.

虽然2009年的情况可能是28天,但如果今天有所不同,我也不会感到惊讶。文档中的含糊不清是苹果公司毫不犹豫地改变这个超时期限的一个很好的借口。

#2


2  

Upon digging the docs I found out that we can use 'expiration date' parameter to control the queuing of APNS notifications.

在挖掘文档时,我发现我们可以使用“过期日期”参数来控制APNS通知的排队。

Here is the detailed explanation on the usage of expiration date

以下是有效期限使用的详细说明

apns-expiration

APNS过期

A UNIX epoch date expressed in seconds (UTC). This header identifies the date when the notification is no longer valid and can be discarded.

以星期(UTC)表示的UNIX纪元日期。此标头标识通知不再有效的日期,可以将其丢弃。

If this value is nonzero, APNs stores the notification and tries to deliver it at least once, repeating the attempt as needed if it is unable to deliver the notification the first time. If the value is 0, APNs treats the notification as if it expires immediately and does not store the notification or attempt to redeliver it.

如果此值非零,则APN会存储通知并尝试至少传递一次,如果第一次无法传递通知,则会根据需要重复尝试。如果值为0,则APN会将通知视为立即过期,并且不会存储通知或尝试重新发送通知。

#1


17  

Official developer documentation isn't clear about this. From developer.apple.com:

官方开发者文档不清楚这一点。来自developer.apple.com:

Apple Push Notification Service includes a default Quality of Service (QoS) component that performs a store-and-forward function. If APNs attempts to deliver a notification but the device is offline, the QoS stores the notification. It retains only one notification per application on a device: the last notification received from a provider for that application. When the offline device later reconnects, the QoS forwards the stored notification to the device. The QoS retains a notification for a limited period before deleting it.

Apple推送通知服务包括执行存储转发功能的默认服务质量(QoS)组件。如果APN尝试发送通知但设备处于脱机状态,则QoS会存储通知。它在设备上每个应用程序仅保留一个通知:从该应用程序的提供程序收到的最后一个通知。当离线设备稍后重新连接时,QoS将存储的通知转发到设备。 QoS会在删除之前保留有限时间段内的通知。

But according to PCWorld, it's 28 days:

但根据PCWorld,它是28天:

If the app is running, it gets the notification immediately. If the app isn't running, the notification is held in the phone to be consumed at the app's next launch. If the iPhone is offline when the sender attempts delivery, APNS attempts to send the notification for 28 days.

如果应用程序正在运行,它会立即收到通知。如果应用程序未运行,通知将保留在手机中,以便在应用程序下次启动时使用。如果iPhone在发件人尝试发送时处于脱机状态,则APNS会尝试将通知发送28天。

While 28 days may have been true in 2009, I wouldn't be surprised if its different today. The ambiguity in the documentation is a great excuse for Apple to change this timeout period willy-nilly.

虽然2009年的情况可能是28天,但如果今天有所不同,我也不会感到惊讶。文档中的含糊不清是苹果公司毫不犹豫地改变这个超时期限的一个很好的借口。

#2


2  

Upon digging the docs I found out that we can use 'expiration date' parameter to control the queuing of APNS notifications.

在挖掘文档时,我发现我们可以使用“过期日期”参数来控制APNS通知的排队。

Here is the detailed explanation on the usage of expiration date

以下是有效期限使用的详细说明

apns-expiration

APNS过期

A UNIX epoch date expressed in seconds (UTC). This header identifies the date when the notification is no longer valid and can be discarded.

以星期(UTC)表示的UNIX纪元日期。此标头标识通知不再有效的日期,可以将其丢弃。

If this value is nonzero, APNs stores the notification and tries to deliver it at least once, repeating the attempt as needed if it is unable to deliver the notification the first time. If the value is 0, APNs treats the notification as if it expires immediately and does not store the notification or attempt to redeliver it.

如果此值非零,则APN会存储通知并尝试至少传递一次,如果第一次无法传递通知,则会根据需要重复尝试。如果值为0,则APN会将通知视为立即过期,并且不会存储通知或尝试重新发送通知。