IOS: Is there a way to find out if the user has refused notifications?

With CLAuthorizationStatus I know for sure whether the user has denied application permissions ( kCLAuthorizationStatusDenied ), or if the status is undefined ( kCLAuthorizationStatusNotDetermined ).

... So something similar for notification services? It seems that I can’t find anything, and there seems to be no way to distinguish between the user who denied permissions and the user who has not yet been shown the permissions popup.

+5
source share
2 answers
 if ([[[UIDevice currentDevice]systemVersion]floatValue] >= 8.0) { UIUserNotificationSettings *current = [[UIApplication sharedApplication]currentUserNotificationSettings]; if (current.types != UIUserNotificationTypeNone){ NSLog(@"Notifications Enabled ios 8"); } else { NSLog(@"Notifications not Enabled ios 8"); } } else { UIRemoteNotificationType types = [[UIApplication sharedApplication]enabledRemoteNotificationTypes]; if (types != UIRemoteNotificationTypeNone) { NSLog(@"Notifications Enabled"); } else { NSLog(@"Notifications not Enabled"); } } 
-1
source
 UIUserNotificationSettings *currentSettings = [[UIApplication sharedApplication] currentUserNotificationSettings]; 

This code will give the latest settings related to notifications.

-2
source

Source: https://habr.com/ru/post/1202949/


All Articles