gpt4 book ai didi

push-notification - 推送通知在 iOS 9 中不起作用

转载 作者:行者123 更新时间:2023-12-03 22:46:15 24 4
gpt4 key购买 nike

我已将我的设备升级到 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 上运行良好。

最佳答案

添加后 code在您的项目中创建 证书和临时配置文件 ——

*Just enable this from your X-code*

enter image description here

更多详情 - iOS 9 Push Notification Tutoriyal

关于push-notification - 推送通知在 iOS 9 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32718273/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com