iOS 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:
     (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
}

让明天,不后悔今天的所作所为
原文地址:https://www.cnblogs.com/-yun/p/4813858.html