iOS推送开关
2016-03-04 13:09
507 查看
//这里使用了UISwitch来获取推送的状态 [self.isSoundSend addTarget:self action:@selector(isSoundSendAction:) forControlEvents:UIControlEventValueChanged]; [self.isMessageSend addTarget:self action:@selector(isMessageSendAction:) forControlEvents:UIControlEventValueChanged]; BOOL isNotifyAlert = NO, isNotifySound = NO; float iphoneVersion = [[[UIDevice currentDevice] systemVersion] intValue];//获取iphone的iOS systemVersion if (iphoneVersion >= 8) { UIUserNotificationType types = [[UIApplication sharedApplication] currentUserNotificationSettings].types; isNotifyAlert = (types & UIUserNotificationTypeAlert) == UIUserNotificationTypeAlert; isNotifySound = (types & UIUserNotificationTypeSound) == UIUserNotificationTypeSound; } else { UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes]; isNotifyAlert = (types & UIRemoteNotificationTypeAlert) == UIRemoteNotificationTypeAlert; isNotifySound = (types & UIRemoteNotificationTypeSound) == UIRemoteNotificationTypeSound; } self.isSoundSend.on = isNotifySound; self.isMessageSend.on = isNotifyAlert;
相关文章推荐
- iOS 并发:NSOperation 与调度队列入门(1)
- iOS 并发:NSOperation 与调度队列入门(1)
- 【Xamarin挖墙脚系列:Xamarin.IOS的程序的结构】
- iOS缓存
- iOS之手动内存管理
- ios自定义下拉列表
- IOS证书的申请和使用
- iOS隐藏状态栏、隐藏导航条
- iOS 在tableViewcell的xib文件中添加新的控件 为null
- iOS触摸事件处理
- iOS-GET请求详细操作-GET设置请求头
- IOS 内部测试与开发账号
- iOS下的RSA加密方法
- 直播时代--IOS直播客户端SDK,美艳直播【开源】
- iOS 运行时机制runTime
- 找出程序中的bug——调试
- iOS学习资料
- iOS SDWebImage的原理以及使用流程
- iOS 保持界面流畅的技巧
- 小轮子 ios 获取语言