iOS8之后的远程推送注册代码

if([[[UIDevice currentDevice]systemVersion]floatValue] >=8.0)
        
    {
        
        [[UIApplication sharedApplication]registerUserNotificationSettings:[UIUserNotificationSettings
                                                                           
                                                                           settingsForTypes:(UIUserNotificationTypeSound|UIUserNotificationTypeAlert|UIUserNotificationTypeBadge)
                                                                           
                                                                           categories:nil]];
        
        [[UIApplication sharedApplication]registerForRemoteNotifications];
        
    }else{
        
        //这里还是原来的代码
        
        //注册启用push
        
        [[UIApplication sharedApplication]registerForRemoteNotificationTypes:
         
         (UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeSound|UIRemoteNotificationTypeBadge)];
        
    }

注册APNS推送遇到如下问题:registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later.的解决方案。

你可能感兴趣的:(ios8,apns)