设备令牌是否与设备 ID 一样唯一?

发布于 2024-11-27 20:09:25 字数 41 浏览 0 评论 0原文

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

∞觅青森が 2024-12-04 20:09:25

我假设您指的是可用于以下方法的设备令牌:

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

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

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

通过在每次启动应用程序时请求设备令牌并将其传递给提供商,您可以帮助确保提供商拥有设备的当前令牌。如果用户将备份恢复到创建备份的设备以外的设备(例如,用户将数据迁移到新设备),则他或她必须至少启动一次应用程序才能再次接收通知。如果用户将备份数据恢复到新设备或重新安装操作系统,设备令牌会发生变化。此外,切勿缓存设备令牌并将其提供给您的提供商;每当您需要时,始终从系统获取令牌

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

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.

水溶 2024-12-04 20:09:25

设备令牌是唯一的 ID,但会发生变化。

Device token is unique id but will be change.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文