iOS调到各种权限设置收集

例子  : 通知  

判断通知是否开启  只判断一次

-(void)judgeNoticeState

{

  if(![[NSUserDefaults standardUserDefaults] boolForKey:@"messageFirstStart"]){

    [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"messageFirstStart"];

    if (IOS8) {

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

      if (UIUserNotificationTypeNone == setting.types) {

        //          NSLog(@"推送关闭");

        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"通知权限未开启"

                                                            message:@"通知权限未开启,请进入系统【设置】>【通知】中打开开关,开启通知功能"

                                                           delegate:self

                                                  cancelButtonTitle:@"取消"

                                                  otherButtonTitles:@"立即开启", nil];

        alertView.tag=100;

        [alertView show];

      }else{

        //          NSLog(@"推送打开");

      }

    }else{

      UIRemoteNotificationType type = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];

      if(UIRemoteNotificationTypeNone == type){

        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"通知权限未开启"

                                                            message:@"通知权限未开启,请进入系统【设置】>【通知】中打开开关,开启通知功能"

                                                           delegate:self

                                                  cancelButtonTitle:@"取消"

                                                  otherButtonTitles:@"立即开启", nil];

        alertView.tag=101;

        [alertView show];

      }else{

        //          NSLog(@"推送打开");

      }

    }

  }else{

    //不是第一次启动

         

  }

}

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex

{

  if (buttonIndex == alertView.firstOtherButtonIndex) {

    if (alertView.tag == 100) {

      //iOS8 以上 打开通知界面

      [[UIApplication sharedApplication]openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];

      

    }else if (alertView.tag == 101){

      //iOS7

      [[UIApplication sharedApplication] openURL:[NSURL

                                                  URLWithString:@"prefs:root=General&path=Restrictions"]];

    }

  }

}

//定位服务设置界面
NSURL *url = [NSURL URLWithString:@"prefs:root=LOCATION_SERVICES"];
if ([[UIApplication sharedApplication] canOpenURL:url])
{
    [[UIApplication sharedApplication] openURL:url];
}
//FaceTime设置界面
NSURL *url = [NSURL URLWithString:@"prefs:root=FACETIME"];
if ([[UIApplication sharedApplication] canOpenURL:url])
{
    [[UIApplication sharedApplication] openURL:url];
}
//音乐设置界面
NSURL *url = [NSURL URLWithString:@"prefs:root=MUSIC"];
if ([[UIApplication sharedApplication] canOpenURL:url])
{
    [[UIApplication sharedApplication] openURL:url];
}
//墙纸设置界面
NSURL *url = [NSURL URLWithString:@"prefs:root=Wallpaper"];
if ([[UIApplication sharedApplication] canOpenURL:url])
{
    [[UIApplication sharedApplication] openURL:url];
}
//蓝牙设置界面
NSURL *url = [NSURL URLWithString:@"prefs:root=Bluetooth"];
if ([[UIApplication sharedApplication] canOpenURL:url])
{
   [[UIApplication sharedApplication] openURL:url];
}
//iCloud设置界面
NSURL *url = [NSURL URLWithString:@"prefs:root=CASTLE"];
if ([[UIApplication sharedApplication] canOpenURL:url]
{
   [[UIApplication sharedApplication] openURL:url];
}

参数配置

我在网上找到一个列表,可以跳到这些界面的参数配置:

About — prefs:root=General&path=About
Accessibility — prefs:root=General&path=ACCESSIBILITY
Airplane Mode On — prefs:root=AIRPLANE_MODE
Auto-Lock — prefs:root=General&path=AUTOLOCK
Brightness — prefs:root=Brightness
Bluetooth — prefs:root=General&path=Bluetooth
Date & Time — prefs:root=General&path=DATE_AND_TIME
FaceTime — prefs:root=FACETIME
General — prefs:root=General
Keyboard — prefs:root=General&path=Keyboard
iCloud — prefs:root=CASTLE
iCloud Storage & Backup — prefs:root=CASTLE&path=STORAGE_AND_BACKUP
International — prefs:root=General&path=INTERNATIONAL
Location Services — prefs:root=LOCATION_SERVICES
Music — prefs:root=MUSIC
Music Equalizer — prefs:root=MUSIC&path=EQ
Music Volume Limit — prefs:root=MUSIC&path=VolumeLimit
Network — prefs:root=General&path=Network
Nike + iPod — prefs:root=NIKE_PLUS_IPOD
Notes — prefs:root=NOTES
Notification — prefs:root=NOTIFICATIONS_ID
Phone — prefs:root=Phone
Photos — prefs:root=Photos
Profile — prefs:root=General&path=ManagedConfigurationList
Reset — prefs:root=General&path=Reset
Safari — prefs:root=Safari
Siri — prefs:root=General&path=Assistant
Sounds — prefs:root=Sounds
Software Update — prefs:root=General&path=SOFTWARE_UPDATE_LINK
Store — prefs:root=STORE
Twitter — prefs:root=TWITTER
Usage — prefs:root=General&path=USAGE
VPN — prefs:root=General&path=Network/VPN
Wallpaper — prefs:root=Wallpaper
Wi-Fi — prefs:root=WIFI


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值