[iOS 9.x] Multiple Device Tokens for a Single Device Seem to be Valid

I have an issue that I think is related to Test Flight, but I can't be sure. This may apply for anyone that deletes and re-installs my app from the App Store, even if they are unrelated to my internal or external development team.


At least for users that are in my internal developer group in Test Flight, when they delete and reinstall my app that they were once part of the internal production beta for from the App Store, they generate a brand new device token each time. To be clear, my app was at one point in internal development in Test Flight, but has since expired.


This can be particularly troublesome because if one of my developers downloads my app from an unusual IP (like a cellular connection), then deletes the app, and reinstalls on the in-house WiFi connection, that old token is lost in limbo forever. I cannot locate that "ghost" token to remove it without risking deleting a valid user or more. I say this because I have waited > 30 days and APNS Feedback does _not_ remove this "ghost" token.


My app was originally developed under iOS 8 in April. Whenever a developer or outside user deleted and re-installed my app, they would get the exact same device token. Now, in iOS 9, whenever an internal developer (at the minimum, in the worst case all users) deletes and reinstalls my app from the App Store, they generate a _new_ device token that is completely unrelated to the old one, and both tokens look valid to APNS incorrectly. This goes against everything that the documentation says. I have tracked the documentation closely, and nothing seems to have changed from iOS 8 to iOS 9. I know much was discussed about the "new" way APNS would function (longer IDs, etc.) at WWDC, but none of that is reflected in the official documentation yet that I can find.


I hazard a guess that this is related to the new way push notification permissions are presented to the user in iOS 9. In iOS 8, push notification settings stayed put for something like 24 hours. This was trouble for developers, because if they wanted to "reset" their app, they had to turn the clock forward or backward (can't quite remember which) over 24 hours, and then reboot their phone once or twice to "reset" that push notification permission UIAlertView. Now, anytime you delete and reinstall the app, the UIAlertView is presented and a new token is generated. Apple's feedback service does not seem to have "caught up" with this change and chaos is slowly starting to ensue for my push notification app.


I have not changed my app's bundle identifier or anything. My app is hitting all the correct delegate methods, etc.


I am not the only developer that seems to have this issue, there is at least one thread on Stack Overflow here that seems to be reporting the same issue, and it appears Apple dismissed this as a "beta issue", when, in fact, this problem persists in the iOS 9.1 production release to this day:

http://stackoverflow.com/questions/32275569/apple-push-notification-service-multiple-device-tokens-are-valid-for-the-same


Other users on this official sub-forum also report similar issues in recent months.


Please, would someone from Apple or someone that has insight explain this? I am getting ghost notifications now for over a month that I simply cannot get rid of without risking deleting a valid user. I downloaded my app on an IP I didn't record, and my token refuses to be removed by the Feedback service. I should not have to record which IP is associated with a device for it's entire history, that's not how APNS was designed. The two device tokens that correspond to the same device are both _valid_. I'm getting two notifications for every one I should be getting on the production App Store version of my app.


Thank you dearly to anyone that takes the time to read this and/or reply.

I've found out that this is expected behavior and that I have to store a UUID in Keychain to identify the unique device hardware. I'll have to look into an implementation for this. I can't be sure this is every mentioned in the APNS documentation, but that's apparently the answer.

I can confirm I am seeing the same thing. I have an iOS device that has been issued multiple APNS tokens, many of which are still valid. This results in duplicate push notifications, because our backend service has no one to know which ones are valid. We thought Apple would handle that, but apparently not. NOTE: I am running iOS 9 as well.


So, we really need a unique key for the iOS device/our app combination. Since UDID (device) is no longer available, I am using the Apple Vendor ID (UUID), but that value can change over time as well (Maybe storing the Apple Vendor ID in the Keychain, like 'dgross' mention is the solution??). Since our app, currently requires our member/user to be signed in before opting into push notifications, we have that member/user ID to be used a primary key of sorts. I could use a last device to be used by member ID to be the winner strategry, but the problem with that, is if a member has multiple iOS devices which is pretty common these days (iPad and iPhone), they would only be able to receive push notifications to one device.


Apple, please advise....

I am using Parse, which uses Apple's APN service. I can confirm that the same thing is happening to me as well. iOS 9.1 here.

I can confirm that the same thing is happening to me as well. iOS 9.2 here.

I have a same above issue.


There are 2 available tokens (ios8 token and ios9 token) in my DB. Therefore now my app is receiving 2 push notification messages each time my server send push.

I have no solution for this. Therefore i have to delete one token in my DB directly.


Have any solution or feedback form Apple ?

Same problem here. If I uninstall the app and reinstall it, a new token is generated. When sending push notifications, these old token that shouldn't be valid appears to be valid because the Push Notifications are successfully delivered. The issue is that I receive many times the same Push Notification. Anyone has a solution to this issue?


Thanks for you help!

We have the same problem that we found 2 valid device tokens for 1 device.

However, when we tried to verify "uninstalling and reinstalling would generate a new device token, and the former device token is still valid", we got the opposite result.

Namely, the new device token was generated, but the former device toke became invalid.

I verified this on 3/9/2016 and 3/10/2016.


Not sure if Apple has fixed this bug *partially*:

a) when the app is uninstalled and reinstalled from now on, the old deviceToken become invalid. (no new issues)

b) currently valid device tokens will continue to be valid. (old issues can't be fixed, the device will still receive multi notificatioins from each valid device token)


Can anyone confirm this behavior?

We are also facing the same issue. It becomes really frastrating when user reports this problem and we don't have any solution for it.

On the other platform they atleast provide solution for this problem using canonical registration ID.

We can't clear tokens from DB becaue notification is our one of the major features.

Hope Apple provides some solution.

We are seeing this issue as well. I have written other apps that use push notifications and don't ever recall seeing this behaviour before.


We started to get multiple notifications to the same device, when we checked our backend server code we saw that we had multiple device tokens for the same device, that was not a huge surprise but it seems that new device tokens are being generated more often that they use to be in the past. While trying to narrow the problem of our app/device receving multiple notifications, we went through the process of manually pushing to each of the device tokens in the list for a given device one at a time in order to see which tokens were valid or not. To our surprise we saw that we could push to a single device token and the device would receive two push notifications. This occurs on devices running iOS 9.2.1 we can not reproduce this problem on a device running iOS 8.4.1


Hope Apple can provide some insight as to what is going on here.

I dont see any mention of this being "expected behavior" in the docs. Can you point us to where you saw this, if it is indeed there?

We are also seeing this issue. I hope Apple will respond soon. A potential workaround is to use keychain to have the app store a permanent device Identifier/token, but this issue also has flaws, since keychain will be restored if the user restores settings from an old device when they buy a new device. There might be a workaround for that too, but there seems to be a lot of cases to be providing workarounds for, when the issue is really on the Apple side.

Do you know if this has happened to your users, or is this only happening to people who have had both dev + app store builds on their devices. We've seen it happen to two devices in our office, and no users have complained about it.

This happens to us (not just dev devices, our users too) for the last few weeks (previously we had received no such reports).

It pains me to see such an old thread without any solutions or answers as to what goes wrong.

[iOS 9.x] Multiple Device Tokens for a Single Device Seem to be Valid
 
 
Q