判断iOS的推送是否打开

来源:互联网 发布:淘宝商家中心 编辑:程序博客网 时间:2024/06/05 04:00
[[UIApplication sharedApplication] enabledRemoteNotificationTypes]
该方法返回类型为:
UIUserNotificationType

该类型是个枚举,可以判断各个推送是否打开:

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

注:ios8改变了获取方法

UIUserNotificationType types = [[UIApplication sharedApplication] currentUserNotificationSettings].types;


0 0