Search code examples
iosswiftapple-push-notifications

When the app is in the background, does the APNS token change or become invalid?


We have a problem we can't solve. While the application is waiting in the background, we think the APNS token has changed.

That's why we're wondering.

When the APNS token is changed or invalid. For example, in an application that waits 3 days in the background, can the APNS token be invalid?

If the token application can become invalid while in the background, it means that you should send the server a new token when this app comes to the foreground

If you can answer our questions, you will help us a lot. :)


Solution

  • The APNS token will rarely change and it certainly won't change while the app is simply suspended or not running. Deleting and then re-installing the app will change if.

    Regardless, each time your app launches you should call registerForRemoteNotifications and each time your didRegisterForRemoteNotificationsWithDeviceToken delegate method is called, update your back end.