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

ios8推送问题

时间:2014-09-25 13:32:59      阅读:161      评论:0      收藏:0      [点我收藏+]

标签:ios8   push   推送通知   适配   

ios8推送问题

registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later.

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

判断PUSH是否打开

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


return (types & UIRemoteNotificationTypeAlert);
}


ios8推送问题

标签:ios8   push   推送通知   适配   

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

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