设备令牌是否与设备ID唯一? [英] Is the device token as unique as the device ID?

查看:114
本文介绍了设备令牌是否与设备ID唯一?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我们重置iPhone,设备ID保持不变。设备令牌是否相同?

解决方案

我假设您指的是可用于

等方法的设备令牌p>

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

如果是这种情况,那么不,设备令牌可以将会更改



引自苹果本地和推送通知编程指南


每次启动应用程序时,通过请求设备令牌并将其传递给提供程序,可以帮助确保提供程序具有设备的当前令牌。如果用户将备份还原到创建备份的设备之外的设备(例如,用户将数据迁移到新设备),则他或她必须至少启动一次应用程序才能再次接收通知。如果用户将备份数据还原到新设备或重新安装操作系统,则设备令牌会更改。此外,永远不要缓存设备令牌并将其提供给您的提供商;总是在你需要的时候从系统中获取令牌


我也可以验证这种行为,因为我使用 Urban Airship 作为我的通知提供商,尽管到目前为止我只使用过一个测试设备,但我的帐户中注册了许多设备令牌。


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

解决方案

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.

这篇关于设备令牌是否与设备ID唯一?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆