How to get back "Allow Push Notifications" dialog after it was dismissed once?

Solution 1:

Here's how Apple say you can do it:

Resetting the Push Notifications Permissions Alert on iOS

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:

  1. Delete your app from the device.

  2. Turn the device off completely and turn it back on.

  3. Go to Settings > General > Date & Time and set the date ahead a day or more.

  4. Turn the device off completely again and turn it back on.

Solution 2:

Since time is money and the other methods take FOREVER—just change your bundle ID over and over while debugging, each time notifications will get queried fresh. Once you are satisfied with code return to original bundle ID.


Key Notes from comments below:

  • Temporarily turn off all other Capabilities (like IAP) to get around needing to change the provisioning profile.

Solution 3:

On iOS 9.x, you can get the prompt every time you delete the app and reinstall it. This is true for both AppStore production downloads and adhoc mode. The device token will be unique each time.

@chengsam verified this is true in iOS 10 as well. @WongWray verified this is true in iOS 11 as well.