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”]];

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM