7

I'm seeing different tokens returned for the same app on the same device:

-(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken

between installs.

For example after first install it will return token 'A' and if i remove the app and re-install it will return token 'B'. I'm seeing this behavior on iOS 9 latest beta, and wonder if this is by design or just a bug.

Cherpak Evgeny
  • 2,659
  • 22
  • 29
  • from what I'm seeing on iOS 7 or 8 devices your statement is not correct. – Cherpak Evgeny Jul 23 '15 at 12:04
  • I would imagine it is by design, but I can't know for sure. Regardless, you should re-register the token every time your app starts as it has always been documented that the token can change. – Paulw11 Jul 23 '15 at 12:30
  • I am seeing this also, not on ios8 or ios7 but on ios9 it asks the user if they want to allow push notifications on each install and has a different device token each time. – RJDubz Sep 21 '15 at 15:26
  • I don't think you're crazy. I'm seeing this same behavior as well in my ionic app running on iOS 9. – Android Noob Sep 29 '15 at 17:26

2 Answers2

2

I tested on a device running iOS 8, iOS 9.0.1 and one running iOS 9.0.2. The devices with 8 & 9.0.2 behaved the same (returns the same device token between installs); so, it appears to be a bug introduced in iOS 9 that is fixed in iOS 9.0.2.

JoeyBartez
  • 63
  • 8
0

Whenever you install the app on the same device, you will get different device token. Please check Is the APN Device Token unique to each individual app?

Community
  • 1
  • 1
VJVJ
  • 435
  • 3
  • 21
  • again, I'm holding 2 devices in my hands right now. one runs iOS 8.4 and gets the same token all the time for my app, the second one runs iOS 9 beta 3 and every time i re-install the app I'm getting different token. – Cherpak Evgeny Jul 23 '15 at 12:12
  • now apple stated that tokens can change between installs but its not what I'm seeing with my own eyes at this very moment – Cherpak Evgeny Jul 23 '15 at 12:13
  • 1
    @CherpakEvgeny where did you see the documentation stating that tokens can change between installs? Thanks! – DeepFriedTwinkie Sep 25 '15 at 22:16
  • 2
    Look for this line "Device tokens can change, so your app needs to reregister every time it is launched." here: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/IPhoneOSClientImp.html#//apple_ref/doc/uid/TP40008194-CH103-SW1 – Cherpak Evgeny Sep 29 '15 at 09:32
  • Yes but I believe it always said that. If you look at the revision history of that page it has not changed for any reason pertaining to this. It also specifies times when the deviceToken will change (device restore, OS reinstall etc.) but does not mention it will change with each install. I fairly certain its a bug. The documentation also still says it should only ask to allow push notifications once in a 24 hour period and it doesnt do that anymore either. – RJDubz Sep 29 '15 at 18:29
  • Well I think they covered their ass by saying that before, and now finally matched the behavior of the iOS to the documentation :-) – Cherpak Evgeny Sep 30 '15 at 13:33