2016-02-24 获取设备 通知开关

if ([[UIDevice currentDevice].systemVersion floatValue]>=8.0f) {
UIUserNotificationSettings *setting = [[UIApplication sharedApplication] currentUserNotificationSettings];
if (UIUserNotificationTypeNone == setting.types) {
NSLog(@"推送关闭8");
xiaoxi=@"已关闭";
}else{
NSLog(@"推送打开8");
xiaoxi=@"已打开";
}
}else{
UIRemoteNotificationType type = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
if(UIRemoteNotificationTypeNone == type){
xiaoxi=@"已关闭";
}else{
xiaoxi=@"已打开";
}
}

 

 

原文地址:https://www.cnblogs.com/gzz2016/p/5212697.html