detect “Allow Notifications” is on/off for iOS8

后端 未结 11 1404
我寻月下人不归
我寻月下人不归 2020-12-01 06:32

I am trying to detect the Local notification settings for the App in iOS 8

for UIUserNotificationSettings, it returns me 7 as I have turned on all Badge

11条回答
  •  悲&欢浪女
    2020-12-01 06:44

    You can control the hash value of UIApplication.sharedApplication().currentUserNotificationSettings().

    if(UIApplication.instancesRespondToSelector(Selector("registerUserNotificationSettings:"))){
            if(UIApplication.sharedApplication().currentUserNotificationSettings().hashValue == 0){
                pushNotificationStatus = "false"
            } else {
                pushNotificationStatus = "true"
            }
    }
    

提交回复
热议问题