When I install my iOS application using Xcode for the first time, my iPhone asks whether I want to enable push notifications.
I am able to send a notification, and the badge shows a number that I sent.
When I delete the application from my iPhone and rebuild it in Xcode and reinstall it again on my iPhone (using Xcode):
I tried the same application on a fresh device (installed the IPA) and it asked me for permissions.
How can I completely make my device forget the application?
Thanks
Updated for iOS 7 and later from Apple's docs:
On iOS 7 and later, The first time a push-enabled app registers for push notifications, iOS asks the user if they wish to receive notifications for that app. Once the user has responded to this alert it is not presented again unless the device is restored or the app has been uninstalled for at least a day.
If you want to simulate a first-time run of your app, you can leave the app uninstalled for a day. You can achieve the latter without actually waiting a day by following these steps:
- Delete your app from the device.
- Turn the device off completely and turn it back on.
- Go to Settings > General > Date & Time and set the date ahead a day or more.
- Turn the device off completely again and turn it back on.
For iOS 5 and iOS6:
Reset the push notifications permissions alert by restoring the device from a backup (r. 11450187). Here are the steps to do this efficiently:
- Use the Xcode Organizer to install your app on the device. The key is to install the app for the first time without running it.
- Use iTunes to back up the device.
- Run the app. The push notifications permissions alert will be presented.
- When you want to reset the push notifications permissions alert, restore the device from the backup you created in the first step.
https://developer.apple.com/library/content/technotes/tn2265/_index.html