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

registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later

2014-09-30 17:05 429 查看
今天遇到了registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later   这个问题,下面是解决的方法:

//
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)];
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐