判斷iOS裝置的PUSH通知設定狀態(開啟。。。/關閉)
阿新 • • 發佈:2019-01-09
typedef NS_OPTIONS(NSUInteger, UIRemoteNotificationType) { UIRemoteNotificationTypeNone = 0, UIRemoteNotificationTypeBadge = 1 << 0, UIRemoteNotificationTypeSound = 1 << 1, UIRemoteNotificationTypeAlert = 1 << 2, UIRemoteNotificationTypeNewsstandContentAvailability = 1 << 3, } NS_ENUM_AVAILABLE_IOS(3_0);
UIRemoteNotificationTypeNone = 0,
UIRemoteNotificationTypeBadge = 1,
UIRemoteNotificationTypeSound = 2,
UIRemoteNotificationTypeAlert = 4,
UIRemoteNotificationTypeNewsstandContentAvailability = 8
通過 UIRemoteNotificationType type = [[UIApplicationsharedApplication] enabledRemoteNotificationTypes];可以得知type的值,根據type的值可以判斷出使用者在通知設定中是如何設定的。
比如:type = 3,那麼使用者開啟的是UIRemoteNotificationTypeBadge和UIRemoteNotificationTypeSound;
type = 6,那麼使用者開啟的是UIRemoteNotificationTypeSound和UIRemoteNotificationTypeAlert,
以此類推即可~