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

iOS8注册推送

2014-10-24 15:36 225 查看
Apple在9月18日正式发布了iOS8,在收到更新的同时,也发现自己的应用在iOS8下无法启动。

并且在Console中收到如下提示:
registerForRemoteNotificationTypes:
is not supported in iOS
8.0

and
later.


解决方案:需兼容iOS7和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:(UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeSound|UIRemoteNotificationTypeBadge)];
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: