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