Is the device token as unique as the device ID?

痞子三分冷 提交于 2019-12-21 03:18:33

问题


If we reset an iPhone, the device ID remains the same. Is it the same for the device token?


回答1:


I assume you are referring to the device token available to methods such as

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

If this is the case, then no, the device token can and will change.

Quoted from Apples Local and Push Notification Programming Guide

By requesting the device token and passing it to the provider every time your application launches, you help to ensure that the provider has the current token for the device. If a user restores a backup to a device other than the one that the backup was created for (for example, the user migrates data to a new device), he or she must launch the application at least once for it to receive notifications again. If the user restores backup data to a new device or reinstalls the operating system, the device token changes. Moreover, never cache a device token and give that to your provider; always get the token from the system whenever you need it

I can also verify this behaviour as I use Urban Airship as my notification provider and even though I have only ever used a single test device so far, there are numerous device tokens registered with my account.




回答2:


Device token is unique id but will be change.



来源:https://stackoverflow.com/questions/6927011/is-the-device-token-as-unique-as-the-device-id

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!