My app registers for the notifications like this :
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert];
but if I manually go to the notifications settings, disable everything (notification center, alert, sound, badge) then uninstall and reinstall the app (or just reinstall without uninstalling first), my iPhone keeps the old settings. How can I force to reactivate these settings back on reinstallation?
You can't. In iOS 5.0 there was a not documented feature to open the notification setting page (or any setting page) from your application via an url scheme. Then you could ask the user to enable the notifications. But it was removed in 5.1 and anyway probably would not be accepted by Apple.
registerForRemoteNotificationTypes asks the user whether he wants to accept notifications from your application only the first time you call it. If later the user changes the notification settings then it will not ask it again any more. You can check whether notifications are enabled for your application with enabledRemoteNotificationTypes and warn the user yourself if you want, but user will have to go manually to the settings and re-enable them. You can't do it any more from your application.
UPDATE as of iOS 8.0
From iOS 8.0 Apple returned the possibility to open the System Settings page of your app:
NSURL* settingsURL = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
[[UIApplication sharedApplication] openURL:settingsURL];
You need to reset push notification permissions.Apple provide a way to reset the permissions-
Resetting the Push Notifications Permissions Alert on iOS
For the first time a push-enabled applications, registers for push notifications. iOS asks the user if they wish to receive remote notifications for that particular app. Once the user has responded to this alert it is not presented again and 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.
For more details see: https://developer.apple.com/library/ios/technotes/tn2265/_index.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With