Duplicate Apple APNS push notifications?

2019-03-12 06:14发布

问题:

We've been using APNS on our app without much incident for some time now, and suddenly our users are reporting receiving the same push notification multiple times.

I've confirmed - tediously - that our servers are only sending the notification payloads to Apple once, and yet the notification produces 2 and sometimes 3 identical alerts, both in the banner and notification center.

This has been observed in both iOS5 and iOS6.

Has anybody seen this phenomenon before? Am I perhaps missing some opportunity to add a unique identifier to the payload that will prevent Apple from sending duplicate notifications to the device? Google's C2DM has collapse_key for this sort of thing, but I can find no reference to a similar functionality in APNS.

回答1:

Are you able to replicate this issue? You should try and add identifiers to notification if it's not a productions server. Also check if user doesn't have mutiple logins in your database. For eg. With twitter, Facebook and password etc and all have same device token.

Had a similar issue some time back and digging deep I found that these users had multiple editions of beta iOS firmware on their phone beside final version and this was causing apple servers to send same notification to Same device ID mutiple times.

Some blogs have instructions for consumers out there and very litte we could do.