博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
iOS 判断推送开关是否打开
阅读量:7060 次
发布时间:2019-06-28

本文共 508 字,大约阅读时间需要 1 分钟。

方案如下:

根据 [[UIApplication sharedApplication] enabledRemoteNotificationTypes] 的返回值来进行判断,该返回值是一个枚举值,如下:

1
2
3
4
5
6
7
typedef
 
enum
 
{
    
UIRemoteNotificationTypeNone
    
=
 
0
,
    
UIRemoteNotificationTypeBadge
   
=
 
1
 
<
<
 
0
,
    
UIRemoteNotificationTypeSound
   
=
 
1
 
<
<
 
1
,
    
UIRemoteNotificationTypeAlert
   
=
 
1
 
<
<
 
2
,
    
UIRemoteNotificationTypeNewsstandContentAvailability
 
=
 
1
 
<
<
 
3
,
}
 
UIRemoteNotificationType
;

如果是 UIRemoteNotificationTypeNone ,则可以认为推送开关没有打开,反之亦然。

转载于:https://www.cnblogs.com/elviszhou/archive/2013/03/05/2943997.html

你可能感兴趣的文章
Mac 配置android环境变量
查看>>
SkyLine二次开发——解决在web页面启动时自动运行TerraExplorer的问题
查看>>
约瑟夫环(Josehpuse)的模拟
查看>>
CSS小技巧
查看>>
正则匹配&nbsp;
查看>>
shell 读取文件
查看>>
给视图添加阴影
查看>>
数组2
查看>>
在django中,执行原始sql语句
查看>>
配置eclipse使能打开当前文件所在目录
查看>>
Repeater内RadioButton.GroupName失效
查看>>
【算法学习笔记】17.暴力求解法05 隐式图搜索1 迭代加深搜索 埃及分数
查看>>
如何高效利用GitHub
查看>>
html中特殊符号
查看>>
X-Frame-Options,X-XSS-Protection,X-Content-Type-Options
查看>>
Android 下的 USB HID 设备读写
查看>>
CSV文件转JSON
查看>>
Android Context类
查看>>
ztree 根据id选中某一点且触发当前点的click事件
查看>>
10.16复习 数位DP——不要62
查看>>