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

registerForRemoteNotificationTypes: is not supported in iOS 8.0 and

时间:2014-10-10 15:13:54      阅读:173      评论:0      收藏:0      [点我收藏+]

标签:is not supported in   推送   ios8   registerforremotenot   

注册方式:

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) {
        [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings
                                                                             settingsForTypes:(UIUserNotificationTypeSound |
                                                                                               UIUserNotificationTypeAlert |
                                                                                               UIUserNotificationTypeBadge)
                                                                             categories:nil]];
        [[UIApplication sharedApplication] registerForRemoteNotifications];
        
    }
    else {
        [[UIApplication sharedApplication]registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert|
                                                                            UIRemoteNotificationTypeBadge|
                                                                            UIRemoteNotificationTypeSound]; 
    }


同理判断消息推送是否打开也有变化

UIRemoteNotificationType types;
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
    types = [[UIApplication sharedApplication] currentUserNotificationSettings].types;
else
    types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
return (types & UIRemoteNotificationTypeAlert);



registerForRemoteNotificationTypes: is not supported in iOS 8.0 and

标签:is not supported in   推送   ios8   registerforremotenot   

原文地址:http://blog.csdn.net/cerastes/article/details/39958999

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