Skip to content

Commit

Permalink
fix issue phonegap-build#354 (enabledRemoteNotificationTypes is not s…
Browse files Browse the repository at this point in the history
…upported in iOS 8.0 and later.)
  • Loading branch information
rossmartin committed Nov 3, 2014
1 parent 1979d97 commit 6cf2e1a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/ios/PushPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,16 @@ - (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 = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];

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

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

0 comments on commit 6cf2e1a

Please sign in to comment.