Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clear preference iOS push notifications for my application?

Hello When the application is installed, it asks the user for permission to send push notifications. I'm testing my application. But after removing it from the device and then install it no longer asks for permission. How do I remove these settings so that it once again asked for permission?

I need it to test server push notifications.

like image 541
EndyVelvet Avatar asked Mar 31 '12 20:03

EndyVelvet


3 Answers

Please try using UIApplication's - (void)unregisterForRemoteNotifications method.

like image 152
J S Rodrigues Avatar answered Oct 19 '22 08:10

J S Rodrigues


You can as see here: https://developer.apple.com/library/mac/technotes/tn2265/_index.html as below.

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:

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.

like image 35
Fernando Martínez Avatar answered Oct 19 '22 08:10

Fernando Martínez


the allow dialog for the iOS push notification appear one time every 24 hour .. so all what you need to modify the device date manually and set it to be 1 day after the date that dialog appear on it.

like image 4
Malek_Jundi Avatar answered Oct 19 '22 08:10

Malek_Jundi