if([application respondsToSelector:@selector(registerUserNotificationSettings:)]) {
[self registerForiOS8PushSettings]; //for iOS8
} else {
//iOS7 or earlier
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
}
Unable to get the push notification to iOS7 device. didRegisterForRemoteNotificatiosnWithDeviceToken get called, In fact Message is successfully delivered. Working fine in iOS8.
Anil Varghese
43k9 gold badges96 silver badges110 bronze badges
-
possible duplicate of iOS 8 enabled device not receiving PUSH notifications after code updateCRDave– CRDave2014年11月05日 11:08:06 +00:00Commented Nov 5, 2014 at 11:08
1 Answer 1
With the iOS8 the process had change. To make your app register for iOS8 and early versions make something like this:
-(void)registerAppForNotifications{
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
{
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else
{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeNewsstandContentAvailability| UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
}
}
answered Nov 5, 2014 at 11:18
Sign up to request clarification or add additional context in comments.
Comments
default