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.
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.
Please try using UIApplication's
- (void)unregisterForRemoteNotifications
method.
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.
This just worked for me in iOS7:
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.
Re-install app
Running on iOS 6.0, the "delete and wait 24 hrs" approach did not work for me. Unregistering/re the device token does not work either, which appears to be a bug on Apple's part. The technical note from Apple was last updated on Sept 2011 and appears out of date.
I was able to trigger the permission alert again only by completely resetting a device. This is quite a pain for testing but it works.
Sadly there's no way to ask users to do this if they change their minds about receiving push notifications from your app, so make sure you ask for permission at the best possible time.
I read once that you have to delete the app completely from your device and wait 24 hours then reinstall it (a complete device turn off is recommended too), this way it will ask you for the permissions again, but I never tried that. Anyway I don't think you really need to get these permissions again, why would you need that?
As J S Rodrigues said you could unregister your device any time. Yet I'm not sure why you tried to once again asked for permission. If you're running APN on your own server, then after register your device, a device token from - (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken method should be posted to your APN system, once and for all.
So if you tried to test if a device token could be posted to your own system, the the unregister method might be needed.
Otherwise, not necessary to do that, since the token is recorded in your system, you could just remove it. And every other time the app is launched, a new record will be added to the APN system.