3

I'm seeing some very strange behaviour from the Apple Push Notification Servers when the recipient iPhone is off. Here is my scenario:

-Send push notification A to Apple. Within a few seconds a push notification popup gets displayed as expected on the iPhone.
-Send blank notification to Apple to cancel previous one (the previous notification is pointless after about 10 seconds, that's why I want to get rid of it). Nothing displayed on the iPhone.
-Turn OFF iPhone completely (not asleep, it is powered down).
-Send push notification B to Apple. Wait 10 seconds.
-Send blank notification to Apple to cancel previous one. Wait 10 seconds.
-Send push notification C to Apple. Wait 10 seconds.
-Send blank notification to Apple to cancel previous one. Wait 30 seconds.
-Turn ON iPhone.
-After about 60 seconds a push notification popup is displayed for notification B on the iPhone.
-Notification C never seems to arrive.

This is very strange! From reading the Apple docs I was expecting only the latest push notification to be sent. I was hoping my blank notification would be sent, I certainly wasn't expecting the oldest unsent push notification to be sent!

The Apple docs say:

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.

Has anybody seen this behaviour? Am I just hitting some sort of timing window bug? What should happen?

Updates:
-If I turn the phone off and wait 5 to 15 minutes before sending any push notifications then this problem doesn't occur. In this case when I turn the phone on I don't see any notification popup, although I'm not sure if this is a result of Apple dropping the notification, or their 'queue' working correctly (i.e. holding the newest blank notification instead of the first one with the popup).
-I will investigate further by putting an APNsLogging.mobileconfig onto the iPhone to see what notifications it got.
-Turning wifi off doesn't seem to change the results.
-I have raised a bug report with Apple for this scenario.

4

4 に答える 4

3

セルラーネットワークとWiFiネットワークの両方でこの動作を確認することをお勧めします。電話がWiFiに接続されている場合、特に複数のNATルーターが関係している場合、つまりメインルーターとフロアごとのWiFiルーターがある大企業や、複数のルーターが使用されている家庭では、多くの奇妙な動作が発生します。範囲を拡張します。しかし、セルではかなり堅実です。

また、10秒のキャンセル遅延はそれを近づけすぎている可能性があります。それらはタイムリーな配信を保証するものではなく、プッシュ要求をキューに入れてから本番サーバーで3分もの遅延が発生しました。システムの輻輳を計画することをお勧めします。

いずれにせよ、バグレポーターの報告に値するかもしれないように思えます。

于 2009-10-28T18:03:37.537 に答える
1

記録のために、私はこれをバグ ID #7349660 として 10 月 29 日に Apple に報告し ( https://bugreport.apple.com )、10 月 30 日に追加の診断を提供しました。

それ以来、Apple からの応答はありません。したがって、これはおそらく優先順位リストの下位にあると推測しています。これは、問題が発生する可能性のある非常に小さなタイミング ウィンドウであるため、十分に公平です (これを最初に開いたときは気づきませんでした)。質問)。

于 2009-12-14T22:42:48.820 に答える
0

C は B からどのくらいで送信されましたか? ある種のタイムアウトサーバー側があり、Cが送信された直後にBが誤って保持されるバグのようです...

良いテスト例があれば (そしてこれは良いテストのように思えます)、私はこれについて Radar レポートを提出します。

于 2009-10-28T23:34:55.530 に答える
0

Apple のドキュメントでは、プッシュ通知を最大 30 日間キャッシュできると言われています。そのため、iPhone をオンにするとプッシュ通知が届く場合があります (相互接続している場合)。

于 2009-10-28T18:23:31.523 に答える