iOS----------获取通知状态并跳转设置界面设置

跳转app对应的系统通知设置

    if (UIApplicationOpenSettingsURLString != NULL) {

        UIApplication *application = [UIApplication sharedApplication];

        NSURL *URL = [NSURL URLWithString:UIApplicationOpenSettingsURLString];

        if ([application respondsToSelector:@selector(openURL:options:completionHandler:)]) {

            [application openURL:URL options:@{} completionHandler:nil];

        } else {

            [application openURL:URL];

        }

    }

 获取用户通知中心对程序消息通知的设置,是否开启消息通知

    if ([[UIDevice currentDevice].systemVersion floatValue]>=8.0f) {

        UIUserNotificationSettings *setting = [[UIApplication sharedApplication] currentUserNotificationSettings];

        if (UIUserNotificationTypeNone == setting.types) {

            NSLog(@"推送关闭");

        }else{

            NSLog(@"推送打开");

        }

    }else{

        UIRemoteNotificationType type = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];

        if(UIRemoteNotificationTypeNone == type){

            NSLog(@"推送关闭");

        }else{

            NSLog(@"推送打开");

        }

    } 

 在iOS应用程序中打开设备设置界面及其中某指定的选项界面

    [[UIApplicationsharedApplication] openURL:[NSURL URLWithString:@”prefs:root=General”]];

    [[UIApplicationsharedApplication] openURL:[NSURL URLWithString:@”prefs:root=General&path=Restrictions”]];

 

iOS----------获取通知状态并跳转设置界面设置

上一篇:LVS-NAT实战:搭建HTTP及HTTPS负载均衡集群


下一篇:灵异事件之:Android Studio 3.4提示:Error running app: Default Activity Not Found