I develop an app, which builds itself around push notifications. The app requests notification permissions only when the user reaches certain point of the registration process. I have already managed to do the following:
- the app maintains an
NSUserDefaults
variable, which indicates if it is required to register for push at launch or not (by default: not) - when the registration reaches that point, I flip the variable and call
-registerForRemoteNotificationTypes:
on iOS 7 and-registerUserNotificationSettings:
on iOS 8
This works fine unless the user has already enabled push notifications and then disabled them later in the Settings. In this case I try to reregister Push at launch, which does not call either -application:didRegisterForRemoteNotificationsWithDeviceToken
nor -application:didFailToRegisterForRemoteNotificationsWithError
.
Additional information, that iOS 8's -isRegisteredForRemoteNotifications
also returns YES
. (I did not test but suppose that -enabledNotificationTypes
works upto iOS 7.)
How can I detect this scenario and present the user a requester which asks him to reenable notifications in the Settings?