Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

registerUserNotificationSettings only asks me once if "APPNAME would like to use push notifications". I need it to ask me again for testing. How?

I'm testing Push Notifications right now.

registerUserNotificationSettings is supposed to ask the user once and only once if "APPNAME would like to send Push Notifications". However, I'm testing my app right now and I need it to ask me again. I've deleted the application from my device, and re-run the application on my device from XCode but I cannot get it to ask me again.

What do I need to delete from my device to get this question to show up again?

like image 707
chris P Avatar asked Oct 31 '22 06:10

chris P


2 Answers

I found the answer. https://developer.apple.com/library/ios/technotes/tn2265/_index.html#//apple_ref/doc/uid/DTS40010376-CH1-TNTAG42

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.

like image 199
chris P Avatar answered Nov 15 '22 09:11

chris P


Perhaps a rather obvious solution, but if your test device is your main (personal) device, you can test this using the simulator, which is of course very easy to reset.

This would be much faster than turning you device off/on, change date, turn off/on again.

like image 42
Jeroen Bouma Avatar answered Nov 15 '22 08:11

Jeroen Bouma