Building for iOS if registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later Building for iOS if registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later xcode xcode

Building for iOS if registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later


iOS 8 has changed notification registration. So you need to check device version and then you need to register notification settings.(please check this link.)I try this code on Xcode 6 and its worked for me.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{        if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)        {            [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];            [[UIApplication sharedApplication] registerForRemoteNotifications];        }        else        {            [[UIApplication sharedApplication] registerForRemoteNotificationTypes:             (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];        }     return YES;}


You might want to consider using respondsToSelector rather than checking the system version:

if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)]){    [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];    [[UIApplication sharedApplication] registerForRemoteNotifications];}else{    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:     (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];}


#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000    [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];    [[UIApplication sharedApplication] registerForRemoteNotifications];#else    [[UIApplication sharedApplication] registerForRemoteNotificationTypes(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];#endif