UIUserNotificationSettings is deprecated in iOS8. If you want to access the general status of your application settings, check out UNUserNotifications, a new framework. I understand that he treats jerks and locals as one. When you register notifications, you can call to register. But for local permissions - icons, etc. You still need to request user permission. That is, your device can receive push notifications without user permission to receive data updates, but you can only show notifications through the center with permissions. Here's how to find out what permissions have been granted.
Import the framework into your class
@import UserNotifications;
Request settings
- (void)_queryNotificationsStatus { UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; [center getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings *settings){ //1. Query the authorization status of the UNNotificationSettings object switch (settings.authorizationStatus) { case UNAuthorizationStatusAuthorized: NSLog(@"Status Authorized"); break; case UNAuthorizationStatusDenied: NSLog(@"Status Denied"); break; case UNAuthorizationStatusNotDetermined: NSLog(@"Undetermined"); break; default: break; } //2. To learn the status of specific settings, query them directly NSLog(@"Checking Badge settings"); if (settings.badgeSetting == UNAuthorizationStatusAuthorized) NSLog(@"Yeah. We can badge this puppy!"); else NSLog(@"Not authorized"); }]; }
source share