Believe in your own future, will thank yourself right now Sinner Yun

Sinner_Yun

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)];
}

posted on 2015-09-16 17:12  Sinner_Yun  阅读(280)  评论(0编辑  收藏  举报

导航