判斷iOS設備的PUSH通知設置狀態(打開。。。/關閉)


[plain]  view plain copy
 
  1. typedef NS_OPTIONS(NSUInteger, UIRemoteNotificationType) {  
  2.     UIRemoteNotificationTypeNone    = 0,  
  3.     UIRemoteNotificationTypeBadge   = 1 << 0,  
  4.     UIRemoteNotificationTypeSound   = 1 << 1,  
  5.     UIRemoteNotificationTypeAlert   = 1 << 2,  
  6.     UIRemoteNotificationTypeNewsstandContentAvailability = 1 << 3,  
  7. } NS_ENUM_AVAILABLE_IOS(3_0);  

 

UIRemoteNotificationTypeNone = 0,

UIRemoteNotificationTypeBadge = 1,

UIRemoteNotificationTypeSound = 2,

UIRemoteNotificationTypeAlert = 4,

UIRemoteNotificationTypeNewsstandContentAvailability = 8

 

通過 UIRemoteNotificationType type = [[UIApplication sharedApplicationenabledRemoteNotificationTypes];可以得知type的值,根據type的值可以判斷出用戶在通知設置中是如何設置的。

比如:type = 3,那么用戶打開的是UIRemoteNotificationTypeBadge和UIRemoteNotificationTypeSound;

    type = 6,那么用戶打開的是UIRemoteNotificationTypeSound和UIRemoteNotificationTypeAlert,

以此類推即可~

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM