检测是否开启推送通知功能

来源:互联网 发布:马尔文粒径分析软件 编辑:程序博客网 时间:2024/05/16 07:23

一般应用中会用到检测手机是否开启推送通知功能,下面是检测是否开启推送通知功能的检测方法:

-(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);

    }

}

0 0
原创粉丝点击