I store the device token value with NSUserdefaults, and then, send this value to my server.
My app checks if this value exists or not.
If the value doesn't exist, my app tries to call the registerdevicetoken
method.
But I found out an issue.
If a user restores his/her iPhone via iTunes, the NSUserdefaults values are recovered. However the stored device token is not a valid device token for a new device, but my app can't recognize that the phone has been reinstalled via iTunes.
How can I collect the correct device token, when users restore their iPhone?