跳转App的系统级设置页面
跳转App设置页

跳转App设置页
-
10.0以前系统
- (BOOL)openURL:(NSURL*)url;
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
-
10.0及以后系统
- (void)openURL:(NSURL*)url options:(NSDictionary<UIApplicationOpenExternalURLOptionsKey, id>*)option completionHandler:(void (^ __nullable)(BOOL success))completion;
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] options:@{} completionHandler:^(BOOL success){
<#coding#>
}];
-
兼容式写法
@available(iOS 10.0, *)
if (@available(iOS 10.0, *)) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] options:@{} completionHandler:^(BOOL success){
<#coding#>
}];
}else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
}
-
15.4新特性
UIApplicationOpenNotificationSettingURLString,该特性可以让App直接跳转到App设置页通知项的子界面(详情界面)
if (@available(iOS 15.4, *)) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenNotificationSettingURLString] options:@{} completionHandler:^(BOOL success){
<#coding#>
}];
}

跳转APP设置“通知”页
跳转手机系统相关设置页面
苹果并没有提供公开的API让App打开手机的相关设置页,但天下没有不透风的墙,也不缺热衷深度挖掘的心,所以私有API往往深得人心,甚至私有API也会与时俱进不断更新。
1. 无效的跳链
格式:prefs:root=xxxx,“xxxx”表示相关设置页
以上跳链即使是配置了URL Schemes也是无效的,App不会有任何跳转

配置URL Schemes
2. 设置主页的跳链
格式:App-Prefs:root=xxxx,“xxxx”表示相关设置页
以上跳链只能跳转到手机系统设置主页面或当前停留页面,不能跳转指定页面,换句话说xxxx在这里是不起作用,即使是xxxx为空也只会跳转到手机系统设置主页或者当前停留的页面。

跳转系统设置主界面
3. 正确(对应设置页)的跳链
格式:App-Prefs:xxxx,“xxxx”表示相关设置页
以上跳链可以跳转对应的xxxx系统设置页(模拟器只能跳转到设置主页),但要注意的是“App”这三个字母必须至少有一个是大写,App后面的Prefs只要拼写没错无论哪个或哪几个字母大写都是可以正常跳转,但是xxxx是区分大小写,必须拼写完全正确才可以正常跳转到相关页面,否则只会跳转到设置的主页或者当前停留的页面甚至不跳转。
以手机无线局域网设置页为例,跳链可以是这样的:App-Prefs:WIFI、APP-Prefs:WIFI、aPp-Prefs:WIFI、apP-Prefs:WIFI、aPP-prefs:WIFI、aPP-pRefs:WIFI、aPP-pReFs:WIFI、aPP-prefs:WIFI、aPP-prefS:WIFI等等,但当xxxx为空时就会跳转到系统设置的主页或者当前停留的页面。
-
跳转“
无线局域网”设置页App-Prefs:WIFI -
跳转“
蓝牙”设置页App-Prefs:Bluetooth -
跳转“
通知”设置页App-Prefs:NOTIFICATIONS_ID -
跳转“
声音”设置页App-Prefs:Sounds -
跳转“
屏幕使用时间”设置页App-Prefs:SCREEN_TIME -
跳转“
通用”设置页App-Prefs:General -
跳转“
显示与亮度”设置页App-Prefs:DISPLAY -
跳转“
主屏幕”设置页App-Prefs:HOME_SCREEN -
跳转“
辅助功能”设置页App-Prefs:ACCESSIBILITY -
跳转“
墙纸”设置页App-Prefs:Wallpaper -
跳转“
Siri与搜索”设置页App-Prefs:SIRI -
跳转“
触控ID与密码”设置页App-Prefs:PASSCODE -
跳转“
SOS紧急联络”设置页App-Prefs:EMERGENCY_SOS -
跳转“
暴露通知”设置页App-Prefs:EXPOSURE_NOTIFICATION -
跳转“
电池”设置页App-Prefs:BATTERY_USAGE -
跳转“
隐私”设置页App-Prefs:Privacy -
跳转“
密码”设置页App-Prefs:PASSWORDS -
跳转“
邮箱”设置页App-Prefs:MAIL -
跳转“
通讯录”设置页App-Prefs:CONTACTS -
跳转“
日历”设置页App-Prefs:CALENDAR -
跳转“
备忘录”设置页App-Prefs:NOTES -
跳转“
提醒事项”设置页App-Prefs:REMINDERS -
跳转“
语音备忘录”设置页App-Prefs:VOICE_MEMOS -
跳转“
电话”设置页App-Prefs:PHONE -
跳转“
信息”设置页App-Prefs:MESSAGES -
跳转“
FaceTime通话”设置页App-Prefs:FACETIME -
跳转“
Safari浏览器”设置页App-Prefs:SAFARI -
跳转“
股市”设置页App-Prefs:STOCKS -
跳转“
天气”设置页App-Prefs:WEATHER -
跳转“
翻译”设置页App-Prefs:TRANSLATE -
跳转“
地图”设置页App-Prefs:MAPS -
跳转“
指南针”设置页App-Prefs:COMPASS -
跳转“
测距仪”设置页App-Prefs:MEASURE -
跳转“
快捷指令”设置页App-Prefs:SHORTCUTS -
跳转“
健康”设置页App-Prefs:HEALTH -
跳转“
音乐”设置页App-Prefs:MUSIC -
跳转“
照片”设置页App-Prefs:Photos -
跳转“
相机”设置页App-Prefs:CAMERA -
跳转“
播客”设置页App-Prefs:PODCASTS -
跳转“
隐私-定位服务”设置页App-Prefs:Privacy&path=LOCATION -
跳转“
隐私-通讯录”设置页App-Prefs:Privacy&path=CONTACTS -
跳转“
隐私-日历”设置页App-Prefs:Privacy&path=CALENDARS -
跳转“
隐私-提醒事项”设置页App-Prefs:Privacy&path=REMINDERS -
跳转“
隐私-照片”设置页App-Prefs:Privacy&path=PHOTOS -
跳转“
隐私-本地网络”设置页App-Prefs:Privacy&path=LOCAL_NETWORK -
跳转“
隐私-麦克风”设置页App-Prefs:Privacy&path=MICROPHONE -
跳转“
隐私-语音识别”设置页App-Prefs:Privacy&path=SPEECH_RECOGNITION -
跳转“
隐私-相机”设置页App-Prefs:Privacy&path=CAMERA -
跳转“
隐私-健康”设置页App-Prefs:Privacy&path=HEALTH -
跳转“
隐私-专注模式”设置页App-Prefs:Privacy&path=FOCUS
[
{"name":"无线局域网","link":"WIFI"},
{"name":"蓝牙","link":"Bluetooth"},
{"name":"通知","link":"NOTIFICATIONS_ID"},
{"name":"声音","link":"Sounds"},
{"name":"屏幕使用时间","link":"SCREEN_TIME"},
{"name":"通用","link":"General"},
{"name":"显示与亮度","link":"DISPLAY"},
{"name":"主屏幕","link":"HOME_SCREEN"},
{"name":"辅助功能","link":"ACCESSIBILITY"},
{"name":"墙纸","link":"Wallpaper"},
{"name":"Siri与搜索","link":"SIRI"},
{"name":"触控ID与密码","link":"PASSCODE"},
{"name":"SOS紧急联络","link":"EMERGENCY_SOS"},
{"name":"暴露通知","link":"EXPOSURE_NOTIFICATION"},
{"name":"电池","link":"BATTERY_USAGE"},
{"name":"隐私","link":"Privacy"},
{"name":"密码","link":"PASSWORDS"},
{"name":"邮箱","link":"MAIL"},
{"name":"通讯录","link":"CONTACTS"},
{"name":"日历","link":"CALENDAR"},
{"name":"备忘录","link":"NOTES"},
{"name":"提醒事项","link":"REMINDERS"},
{"name":"语音备忘录","link":"VOICE_MEMOS"},
{"name":"电话","link":"PHONE"},
{"name":"信息","link":"MESSAGES"},
{"name":"FaceTime通话","link":"FACETIME"},
{"name":"Safari浏览器","link":"SAFARI"},
{"name":"股市","link":"STOCKS"},
{"name":"天气","link":"WEATHER"},
{"name":"翻译","link":"TRANSLATE"},
{"name":"地图","link":"MAPS"},
{"name":"指南针","link":"COMPASS"},
{"name":"测距仪","link":"MEASURE"},
{"name":"快捷指令","link":"SHORTCUTS"},
{"name":"健康","link":"HEALTH"},
{"name":"音乐","link":"MUSIC"},
{"name":"照片","link":"Photos"},
{"name":"相机","link":"CAMERA"},
{"name":"播客","link":"PODCASTS"},
{"name":"隐私-定位服务","link":"Privacy&path=LOCATION"},
{"name":"隐私-通讯录","link":"Privacy&path=CONTACTS"},
{"name":"隐私-日历","link":"Privacy&path=CALENDARS"},
{"name":"隐私-提醒事项","link":"Privacy&path=REMINDERS"},
{"name":"隐私-照片","link":"Privacy&path=PHOTOS"},
{"name":"隐私-本地网络","link":"Privacy&path=LOCAL_NETWORK"},
{"name":"隐私-麦克风","link":"Privacy&path=MICROPHONE"},
{"name":"隐私-语音识别","link":"Privacy&path=SPEECH_RECOGNITION"},
{"name":"隐私-相机","link":"Privacy&path=CAMERA"},
{"name":"隐私-健康","link":"Privacy&path=HEALTH"},
{"name":"隐私-专注模式","link":"Privacy&path=FOCUS"},
]