diff --git a/src/ios/PushPlugin.m b/src/ios/PushPlugin.m index 79174db..6692d38 100644 --- a/src/ios/PushPlugin.m +++ b/src/ios/PushPlugin.m @@ -148,7 +148,7 @@ - (void)isEnabled:(CDVInvokedUrlCommand*)command { { enabled = [application isRegisteredForRemoteNotifications]; } else { - UIRemoteNotificationType types = [application enabledRemoteNotificationTypes]; + UIRemoteNotificationType types = [[application currentUserNotificationSettings] types]; enabled = types & UIRemoteNotificationTypeAlert; } @@ -179,7 +179,12 @@ - (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { [results setValue:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"] forKey:@"appVersion"]; // Check what Notifications the user has turned on. We registered for all three, but they may have manually disabled some or all of them. - NSUInteger rntypes = [[UIApplication sharedApplication] enabledRemoteNotificationTypes]; + NSUInteger rntypes; + if (!SYSTEM_VERSION_LESS_THAN(@"8.0")) { + rntypes = [[[UIApplication sharedApplication] currentUserNotificationSettings] types]; + }else{ + rntypes = [[UIApplication sharedApplication] enabledRemoteNotificationTypes]; + } // Set the defaults to disabled unless we find otherwise... NSString *pushBadge = @"disabled";