码迷,mamicode.com
首页 > 移动开发 > 详细

ios (推送之远程推送)升级成ios8系统之后有些程序接收不到远程推送

时间:2015-01-22 20:17:44      阅读:138      评论:0      收藏:0      [点我收藏+]

标签:ios   远程推送   

维护一个程序,当手机升级到ios8之后就不能接收到远程推送,显示注册失败,查了下资料,原来是没有获取用户许可,加了个方法试了下,ok

if ([[[UIDevice currentDevice]systemVersion ]integerValue] >= 8) {
        
        UIUserNotificationSettings*setting = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil];
        [application registerUserNotificationSettings:setting];
        [application registerForRemoteNotifications];
        
    }else{
        
        [application registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeSound];
        
    }

系统版本不同所用的注册方法也是不一样的,下面是苹果sdk给出的说明:

- (void)registerForRemoteNotificationTypes:(UIRemoteNotificationType)types NS_DEPRECATED_IOS(3_0, 8_0, <span style="color:#FF0000;">"Please use registerForRemoteNotifications and registerUserNotificationSettings: instead"</span>);




ios (推送之远程推送)升级成ios8系统之后有些程序接收不到远程推送

标签:ios   远程推送   

原文地址:http://blog.csdn.net/lv_ruanruan/article/details/43024335

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!