根据 [[UIApplication sharedApplication] enabledRemoteNotificationTypes] 的返回值来进行判断,该返回值是一个枚举值,如下:
typedef enum {
UIRemoteNotificationTypeNone= 0,
UIRemoteNotificationTypeBadge= 1 << 0,
UIRemoteNotificationTypeSound= 1 << 1,
UIRemoteNotificationTypeAlert= 1 << 2,
UIRemoteNotificationTypeNewsstandContentAvailability = 1 << 3,
} UIRemoteNotificationType;
如果是 UIRemoteNotificationTypeNone ,则可以认为推送开关没有打开,反之亦然。
网友评论