ios - APN token 能否/将会改变?

标签 ios apple-push-notifications

使用 APN 的应用程序似乎习惯于在应用程序启动时从操作系统获取 token 。但是,如果一个应用程序已经获取过一次,那么它是否需要再次获取它(如果已经这样做,则将其发送到服务器)是否有任何意义。

从操作系统获取的 APN token 是否会发生变化?

最佳答案

您问题的答案在 Apple 文档(本地和推送通知编程指南)中:

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 or computer other than the one that the backup was created for (for example, the user migrates data to a new device or computer), 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 computer, 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. If your application has previously registered, calling registerForRemoteNotificationTypes: results in the operating system passing the device token to the delegate immediately without incurring additional overhead.

关于ios - APN token 能否/将会改变?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10842349/

相关文章:

iOS清除推送通知

ios - 如何将一个导航 Controller 导航到另一个 iOS 导航 Controller

iphone - 在 Objective-C 中使用 block 而不是函数有优势吗?

ios - 这是什么意思 : +[UAirship executeUnsafeTakeOff:]?

push-notification - 推送通知服务器

iphone - 应用提交到应用商店后添加 iOS 推送通知

ios 应用程序 - 从后台(?)模式定期更新

ios - 为什么 NSHashTable 保持对指针的引用?

ios - NSMutableArray 在 NSLog 中显示 "(" ")"普通括号而不是 "[" "]"方括号

ios - 我的二进制文件没有针对 iPhone 5 进行优化,同时具有本地化的启动画面