To my knowledge, once we got the device token from APNS, we can't get it again. (Except that backup data to a new device or computer, or reinstalls the operating system or any time the device token changes which will call the didRegisterForRemoteNotificationsWithDeviceToken
)
So,
Any time the device token changes , i will replace and save the new device token in the keychain to avoid it disappears for other purposes (likes use device token to the UUID).
Is it possible when the keychain data disappeared, but device token not changes?
( If yes. It will lead to the
didRegisterForRemoteNotificationsWithDeviceToken
not called again,and can't retrieve the last device token. )Or the events let the keychain data disappeared also(generally) let the device token changed (or trigger
didRegisterForRemoteNotificationsWithDeviceToken
again ) ?In my test,
A. "Reset All Settings" in iPhone will not clear the keychain data and trigger
didRegisterForRemoteNotificationsWithDeviceToken
.B. "Erase All Content and Settings" in iPhone will clear the keychain data and remove all your apps. So when re-install the app that will call
didRegisterForRemoteNotificationsWithDeviceToken
again.Case A and B not bother me, and i think that updating the os version, reinstalling the os or any event let the device token changed also.
Anyone knows the correct corresponding state of value change between keychain and device token ?
Thanks!!
Update
The question is any event lets the keychain data disappeared also(generally) triggers the "didRegisterForRemoteNotificationsWithDeviceToken" againg or not?
If not, which event?