Permissions Push Notifications

Trying to get around a few corner cases when push notifications are prohibited in the application, and I have two questions:

1) Is there a way to reset whether the user triggered a notification request?

2) Is there a way to determine if the user said no to the notification request?

+7
ios apple-push-notifications
source share
2 answers

1) Not unless there is a private API that does this, but this is not authorized by Apple

2) When you first start the application after calling registerForRemoteNotificationTypes, you can check whether doneRegisterForRemoteNotificationsWithDeviceToken is called . If it is not, the user said "No, thanks."

+5
source share

You can always check the status of permissions, if the user changes them, you can check them for applicationDidBecomeActive

 - (void)applicationDidBecomeActive:(UIApplication *)application { if ([[UIApplication sharedApplication] respondsToSelector:@selector(isRegisteredForRemoteNotifications)]) { if ([[UIApplication sharedApplication] isRegisteredForRemoteNotifications]){ NSLog(@"Notifications Enabled ios 8"); } else { NSLog(@"Notifications not Enabled ios 8"); } } else { UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes]; if (types & UIRemoteNotificationTypeAlert) { NSLog(@"Notifications Enabled"); } else { NSLog(@"Notifications not Enabled"); } } } 

updated to work on iOS 8 too

+5
source share

All Articles