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.
Go to Settings and tap Notifications. Select an app under Notification Style. Under Alerts, choose the alert style that you want. If you turn on Allow Notifications, choose when you want the notifications delivered—immediately or in the scheduled notification summary.
Go to iOS' settings → "Your app name" → Notifications to ensure notifications are enabled for your app. You will need to restart your app after enabling push notifications. If you find a recent install with a push token in the debug tool, make sure your app is not opened in the foreground during your tests.
You can fix an iPhone that's not getting notifications by restarting it or making sure notifications are turned on. You should also make sure your iPhone is connected to the internet so apps can receive notifications. If all else fails, you should try resetting the iPhone — just make sure to back it up first.
You need to call
[[UIApplication sharedApplication] registerForRemoteNotifications];
in your iOS8 code path, after registering the user notification settings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With