Does device token ever change in Apple Push Notifications

前端 未结 3 466
清歌不尽
清歌不尽 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:59

    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.

提交回复
热议问题