ios (推送之远程推送)升级成ios8系统之后有些程序接收不到远程推送
2015-01-22 19:39
288 查看
维护一个程序,当手机升级到ios8之后就不能接收到远程推送,显示注册失败,查了下资料,原来是没有获取用户许可,加了个方法试了下,ok
if ([[[UIDevice currentDevice]systemVersion ]integerValue] >= 8) {
UIUserNotificationSettings*setting = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil];
[application registerUserNotificationSettings:setting];
[application registerForRemoteNotifications];
}else{
[application registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeSound];
}
系统版本不同所用的注册方法也是不一样的,下面是苹果sdk给出的说明:
- (void)registerForRemoteNotificationTypes:(UIRemoteNotificationType)types NS_DEPRECATED_IOS(3_0, 8_0, <span style="color:#FF0000;">"Please use registerForRemoteNotifications and registerUserNotificationSettings: instead"</span>);
if ([[[UIDevice currentDevice]systemVersion ]integerValue] >= 8) {
UIUserNotificationSettings*setting = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil];
[application registerUserNotificationSettings:setting];
[application registerForRemoteNotifications];
}else{
[application registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeSound];
}
系统版本不同所用的注册方法也是不一样的,下面是苹果sdk给出的说明:
- (void)registerForRemoteNotificationTypes:(UIRemoteNotificationType)types NS_DEPRECATED_IOS(3_0, 8_0, <span style="color:#FF0000;">"Please use registerForRemoteNotifications and registerUserNotificationSettings: instead"</span>);
相关文章推荐
- iOS8中,程序接收不到应用调用系统服务提示的解决方案
- 在iOS8之后的远程推送写法
- iOS---iOS10适配iOS当前所有系统的远程推送
- IOS [推送相关] 在app 内获取系统设置页的通知开关状态,然后使app 和system 开关保持一致 【此功能只适用月IOS8 +】
- IOS中程序如何进行推送消息(本地推送,远程推送)
- iOS远程控制问题,系统远端事件remoteControlReceivedWithEvent捕获不到的问题
- WIN7/8系统下程序接收不到WM_COPYDATA 消息的原因和解决
- IOS中程序如何进行推送消息(本地推送,远程推送)2(下)
- 解决系统下以管理员身份运行的程序接收不到拖放文件消息[WM_DROPFILES]问题的方法
- iOSAPNs在测试环境下可以用,在正式环境下接收不到推送通知
- IOS 11升级之后,程序打包上传因为隐私权限被拒绝!!
- iOS 程序未启动和在前台、后台接收到推送消息的处理方法
- iOS8之后的远程推送注册代码
- iOS—接收到APNs远程推送消息时的处理流程
- XP下wubi 安装的ubuntu内核升级之后无法进入系统的解决办法(初级方法 慎用!)
- 【iphone4 iOS4+升级到 iOS 5 beta7详细过程与iOS 5系统截图】-Himi升级iOS 5 beta7 流程
- 移动社交游戏平台OpenFeint在安卓和iOS平台发布游戏消息推送系统GameFeed
- 系统升级程序的介绍
- 系统升级程序的介绍
- ubuntu server 升级桌面系统+远程登录