I upgarded my Xcode to Xcode 6.0.1, now remote notification registration is not happening for iOS 8 device. It is working fine for iOS 7 device.
I have added the code in app delegate as mentioned below:
//-- Set Notification
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
{
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIRemoteNotificationTypeBadge
|UIRemoteNotificationTypeSound|UIRemoteNotificationTypeAlert) categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
NSLog(@"current notifications : %@", [[UIApplication sharedApplication] currentUserNotificationSettings]);
}
else
{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
}
Even the current notification is present, and it is not nil.
And yet the below method is not called :
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
Screenshot below explains that I have enabled certain options in background mode:
And the notification is set in the device settings for my app.
You need to call
in your iOS8 code path, after registering the user notification settings.
Below code will work in iOS 8.0 Xcode 6.0 or later and also for below versions.
Check following steps hope it will help you
Steps 1 In didFinishLaunchingWithOptions
Step 2