Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enabledRemoteNotificationTypes is not supported in iOS 8.0 and later. #539

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/ios/PushPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

#import "PushPlugin.h"

#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)

@implementation PushPlugin

@synthesize notificationMessage;
Expand Down Expand Up @@ -156,7 +158,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";
Expand Down