I had an issue where a user started receiving double notifications after uninstalling and reinstalling my app, as the device sent to my server 2 different APNS tokens - one from the first installation and the other after reinstalling the app. Since the tokens were different I could not know this is the same device.
Until iOS 9 came out, every time I uninstalled and reinstalled the app, I always got the same APNS, so it was easy to know that this is the same device the user used as before. Since iOS 9, it seems that the APNS token is changed on every installation.
My question is how to tell if a client uninstall and reinstall the app, and update his APNS token instead of adding a new token?
I am asking as this sounds to me like something most iOS developers had to handle, but I couldn't find any best practice from Apple on how to tackle this, so I hoped that other can share their experience with this issue.
This is how we ended up solving it:
On each app launch:
storage and keychain
If anyone has a more elegant way to solve it I would love to hear about it