is not supported in iOS 8.0 and later.

在做Push获取设备device Token是提示如下:

registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later.

解决办法:

之前注册启用Push的代码是:

现改为如下:
    // IOS8新系统需要使用新的代码咯
    if([[[UIDevice currentDevice]systemVersion]floatValue] >=8.0){
        [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound|UIUserNotificationTypeAlert|UIUserNotificationTypeBadge) categories:nil]];
        [[UIApplication sharedApplication] registerForRemoteNotifications];
    }else{
        [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeSound|UIRemoteNotificationTypeBadge)];
    }

猜你喜欢

转载自iaiai.iteye.com/blog/2183195