Does device token ever change in Apple Push Notifications

前端 未结 3 468
清歌不尽
清歌不尽 2021-01-06 19:19

I am developing an iOS app in which i have implemented Push Notification. Everything is working fine. But just wish to ask if device Token for my Apple device will ever cha

3条回答
  •  再見小時候
    2021-01-06 19:55

    From the apple docs -

    The device token is your key to sending push notifications to your app on a specific device. Device tokens can change, so your app needs to reregister every time it is launched and pass the received token back to your server. If you fail to update the device token, remote notifications might not make their way to the user’s device.

    Device tokens always change when the user restores backup data to a new device or computer or reinstalls the operating system. When migrating data to a new device or computer, the user must launch your app once before remote notifications can be delivered to that device.

    Never cache a device token; always get the token from the system whenever you need it. If your app previously registered for remote notifications, calling the registerForRemoteNotifications method again does not incur any additional overhead, and iOS returns the existing device token to your app delegate immediately. In addition, iOS calls your delegate method any time the device token changes, not just in response to your app registering or re-registering.

    For more APNS Doc

提交回复
热议问题