iOS8 兼容 请求开启远程推送代码
来源:互联网 发布:智阳网络口碑 编辑:程序博客网 时间:2024/06/06 01:58
代码如下:
//register for push notification if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8) { [[UIApplication sharedApplication] registerForRemoteNotifications]; UIUserNotificationType types = UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert ; UIUserNotificationSettings * setting = [UIUserNotificationSettings settingsForTypes:types categories:nil]; [[UIApplication sharedApplication] registerUserNotificationSettings:setting]; NSLog(@"isIOS8"); } else { [[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)]; NSLog(@"not isIOS8"); } BOOL bPushEnable = NO; if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8) { UIUserNotificationSettings * pushSetting = [[UIApplication sharedApplication] currentUserNotificationSettings]; if (pushSetting) { UIUserNotificationType pushType = pushSetting.types; NSLog(@"push type = %d", pushType); if (pushType == UIUserNotificationTypeNone) { bPushEnable = NO; } else { bPushEnable = YES; } } } else { UIRemoteNotificationType pushType = [[UIApplication sharedApplication] enabledRemoteNotificationTypes]; NSLog(@"push type = %d", pushType); if (pushType == UIRemoteNotificationTypeNone) { bPushEnable = NO; } else { bPushEnable = YES; } } //如果不能推送 if (bPushEnable == NO) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[UtilsHelper getLocalizeString:@"text_push_notification_title"] message:[UtilsHelper getLocalizeString:@"text_push_notification_content"] delegate:self cancelButtonTitle:[UtilsHelper getLocalizeString:@"text_yes"] otherButtonTitles:nil, nil]; [alert show]; }
0 0
- iOS8 兼容 请求开启远程推送代码
- iOS8 兼容 请求开启远程推送代码
- iOS8 开启定位兼容代码
- ios8 sdk 推送兼容代码 registerForRemoteNotifications
- ios8 远程推送的注册代码
- iOS8远程推送
- ios8远程推送
- iOS8的远程推送
- iOS8下的远程推送
- iOS8 远程推送/用户推送/本地推送/地理位置推送
- iOS本地推送的实现,兼容iOS8
- IOS 推送机制详解,兼容IOS8的推送
- ios8下的远程推送通知
- 在iOS8之后的远程推送写法
- ios远程通知,兼容ios7 ios8
- 远程推送.代码托管
- ios8 推送
- iOS8推送
- 编译与反编译GNU Linux语言文件方法
- 利用Xcode打包app
- 一致哈希算法
- info sharedlibrary command
- 第十三周 项目五:字符串操作(1.2)
- iOS8 兼容 请求开启远程推送代码
- Android 第二个签名漏洞 #9695860 揭秘
- hdu 2087 剪花布条
- Linux及Arm-Linux程序开发笔记(零基础入门篇)
- 第十三周 项目一--数组大折腾(5)
- 利用dmesg和addr2line来重现bug
- 关于Linux cached内存简析
- A Mathematical Curiosity
- 【C】五边形绘制(续)