您的位置:首页 > 移动开发 > IOS开发

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

2015-08-24 00:00 459 查看
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