【发布时间】:2015-12-19 12:20:00
【问题描述】:
我已将我的设备升级到 iOS 9 并将我的 Xcode 环境升级到 7.0 贝塔。推送通知在 iOS 9 中不起作用?
这是我的代码:
float ver = [[[UIDevice currentDevice] systemVersion] floatValue];
if(ver >= 8 && ver<9)
{
if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)])
{
[[UIApplication sharedApplication] registerForRemoteNotifications];
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert) categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
}
}else if (ver >=9){
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else{
//iOS6 and iOS7 specific code
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeAlert];
}
推送通知在使用 Xcode 6.4 构建的 iOS 8 到 8.3 上运行良好。
【问题讨论】:
-
我遇到了同样的问题。如果您找到解决方案,请告诉我
-
有人找到解决方案吗?我遇到了同样的问题。
-
我也遇到了同样的问题..
-
我遇到了同样的问题,推送通知对我有用,即使在 iOS 9 和 xcode 7 上也是如此,上周我升级到 El Capitan 和 XCode 7.1 和 iOS 9.1,然后它们停止工作,我只测试了我的开发环境,但会测试其他人。如果有人有任何想法,请尽快提供解决方案。我尝试使用 Ray 的教程重新生成证书,该教程一直有效,但这次除外
标签: push-notification apple-push-notifications ios9 xcode7