一般應用中會用到檢測手機是否開啟推送通知功能,下面是檢測是否開啟推送通知功能的檢測方法:
-(BOOL)isOpenNotificationFun{
if([[[UIDevice currentDevice] systemVersion]floatValue]>=8.0){
UIUserNotificationType types=[[UIApplication sharedApplication]currentUserNotificationSettings].types;
return (types & UIRemoteNotificationTypeAlert);
}else{
UIRemoteNotificationType types=[[UIApplication sharedApplication]enabledRemoteNotificationTypes];
return (types & UIRemoteNotificationTypeAlert);
}
}