Does device token ever change in Apple Push Notifications

10,829

Solution 1

device Token for my Apple device will ever change

-- YES. If you restores backup data to a new device or reinstall the operating system, the device token changes. So my suggestion is to update the server with token

do we need internet connectivity for generating device token

-- as far as I know, YES. When you register user, you call method for registration for push notification. This on successful registration call the delegate method -

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

indicating you are registered successfully for a push notification or on failure it calls -

- (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error

indicating failed to register for notification.

You can check it by turning off network and running your application.

Solution 2

Based on the Apple Documentation, the answer is YES:

The form of this phase of token trust ensures that only APNs generates the token which it will later honor, and it can assure itself that a token handed to it by a device is the same token that it previously provisioned for that particular device—and only for that device.

If the user restores backup data to a new device or reinstalls the operating system, the device token changes.

Share:
10,829
Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin almost 2 years

    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 change??

    Also do we need internet connectivity for generating device token.

    Thanks