ios 跳系统设置页面

在项目中,我们经常会碰到使用位置的需求。当用户设置app不允许使用位置的时候,最好的用户体验就是直接调转到系统的位置设置界面进行设置。

1.直接从应用中跳转至系统设置中这个应用的权限设置页面

NSURL * url = [NSURLURLWithString:UIApplicationOpenSettingsURLString];

if([[UIApplicationsharedApplication] canOpenURL:url]) {     

[[UIApplicationsharedApplication] openURL:url];  

}

注意⚠️:需要请求一下位置权限或者通知权限,才可以跳进自己的app设置里面,如果没有任何权限请求,就只能跳到系统的设置界面。

2.从应用中跳转至系统其它设置页面

a.需要在info中添加URL types中添加 URL Schemes 为 prefs的url


b.如果只是跳转到其他设置页面,只需要找到对应的页面的URL参数即可,在这里我以定位权限为例:

          注意  ios10之前只要是@"prefs:root=LOCATION_SERVICES"就可以,ios10之后需要是@"App-Prefs:root=LOCATION_SERVICES"

            NSURL *url = [NSURL URLWithString:@"prefs:root=LOCATION_SERVICES"];

            if ([[UIApplication sharedApplication] canOpenURL:url]) {

                [[UIApplication sharedApplication] openURL:url];

            }就可以

下边是一些界面的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

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

VPN — prefs:root=General&path=Network/VPN
Wallpaper — prefs:root=Wallpaper
Wi-Fi — prefs:root=WIFI

Setting—prefs:root=INTERNET_TETHERING

会跳转至通用界面 :

  Phone — prefs:root=Phone

  Photos — prefs:root=Photos

  Usage — prefs:root=General&path=USAGE








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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值