Armands L.
Armands L.

Reputation: 1925

Will push token change when app is rebuilt?

I'm planing to rebuild one of my applications(new Xcode project), which heavily relay on Push Notifications.

Will the push token change after update is installed?

I need notifications to work even if user doesn't open the new app after update.

Upvotes: 0

Views: 308

Answers (2)

Scrungepipes
Scrungepipes

Reputation: 37581

What do you mean by rebuild? Tokens don't change every time an app is rebuilt.

The tokens can change but its unfrequent when they do, when they do is not documented by apple, but I have noticed it will occur if you backup then restore the app from iTunes as one example.

However you system should be designed to cope with them changing - your client code should get the token each time it launches and compare it with a cached version, and if they differ you must send the new one to your server. If the app doesn't have a cached one then send the recently retrieved one to the server.

Upvotes: 3

egarlock
egarlock

Reputation: 579

In your application:didFinishLaunchingWithOptions: method you should make a call to register for push notifications. This will happen every time you start the app as the deviceToken can changed based on [Insert Reasons Here].

This means that you should be checking the new deviceToken every time it is returned and updating this within your service if it changes.

Upvotes: 3

Related Questions