iOS跳转到设置页面、以及子页面
2018-09-06 本文已影响0人
编程猫猫
近来做项目时,想要推送跳转到设置页面和WIFI页面
1、在UIApplication头文件中有一个属性UIApplicationOpenSettingsURLString用于打开系统的设置界面
// 直接打开系统的设置界面
-(void)jumpToSettings
{
NSURL * url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
if([[UIApplication sharedApplication] openURL:url]) {
[[UIApplication sharedApplication] openURL:url];
}
}
2、
/*
Brightness — App-Prefs:root=Brightness 跳转到设置界面
Music Equalizer — App-Prefs:root=MUSIC&path=EQ // 跳转到设置-音乐界面
Music Volume Limit — App-Prefs:root=MUSIC&path=VolumeLimit // 跳转到音乐界面
Nike + iPod — App-Prefs:root=NIKE_PLUS_IPOD // 跳转到设置界面(前提是第一次打开设置)
Network — App-Prefs:root=General&path=Network // 跳转到设置-通用界面
Siri — App-Prefs:root=General&path=Assistant // 跳转到设置-通用界面
Setting —App-Prefs:root=INTERNET_TETHERING // 跳转到设置界面
Usage — App-Prefs:root=General&path=USAGE // 跳转到设置界面
*/
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=WIFI"]];跳转到 设置-WI-FI 界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=Bluetooth"]];跳转到 设置-蓝牙 界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=General"]];跳转到 设置-通用 界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=General&path=DATE_AND_TIME"]];跳转到 设置-通用-日期与时间 界面 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=General&path=About"]];跳转到 设置-通用-关于本机 界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=General&path=ACCESSIBILITY"]];跳转到 设置-通用-辅助功能 界面 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=General&path=AUTOLOCK"]];跳转到 设置-通用-自动锁定 界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=General&path=Keyboard"]];跳转到 设置-通用-键盘 界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=General&path=INTERNATIONAL"]];跳转到 设置-通用-语言与地区 界面 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=General&path=ManagedConfigurationList"]];跳转到 设置-通用-描述文件 界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=General&path=Reset"]];跳转到 设置-通用-还原 界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=General&path=SOFTWARE_UPDATE_LINK"]];跳转到 设置-通用-软件更新 界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=General&path=VPN"]];跳转到 设置-通用-VPN 界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=LOCATION_SERVICES"]];跳转到 设置-隐私-定位服务 界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=FACETIME"]];跳转到 设置-FaceTime 界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=CASTLE"]];跳转到 设置-iCloud 界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=CASTLE&path=STORAGE_AND_BACKUP"]];跳转到 设置-iCloud-存储空间 界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=TWITTER"]];跳转到 设置-Twitter 界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=FACEBOOK"]];跳转到 设置-Facebook 界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=FLICKR"]];跳转到 设置-Flickr 界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=VIMEO"]];转到 设置-Vimeo 界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=Phone"]];跳转到 设置-电话 界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=NOTIFICATIONS_ID"]];跳转到 设置-通知 界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=NOTES"]];跳转到 设置-备忘录 界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=Photos"]];跳转到 设置-照片与相机 界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=MUSIC"]];跳转到 设置-音乐 界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=STORE"]]; 跳转到 设置-iTunes Store与App Store 界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=Sounds"]];跳转到 设置-声音 界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=Wallpaper"]];跳转到 设置-墙纸 界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=SAFARI"]];跳转到 设置-Safari 界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=AIRPLANE_MODE"]];跳转到 设置-飞行模式 界面(没用)
3、
Objective-c
#define iOS10 ([[UIDevice currentDevice].systemVersion doubleValue] >= 10.0)
NSURL *url = [NSURL URLWithString:@"App-Prefs:root=NOTIFICATIONS_ID&path=yourbundleid"]] ;(注:yourbundleid即为你的的bundleIdentifier),跳转到推送设置的最详细界面
if ([[UIApplication sharedApplication] canOpenURL: url]) {
if (iOS10) {
[[UIApplication sharedApplication] openURL: url options:@{} completionHandler:nil];
} else {
[[UIApplication sharedApplication] openURL: url];
}
}
Swift
if let url = URL(string:"App-Prefs:root=NOTIFICATIONS_ID&path=yourbundleid"]) {
if #available(iOS 10.0, *) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
} else {
UIApplication.shared.openURL(url)
}
}
4、参考链接
关于iOS应用跳转“prefs:root”无效的问题(包括iOS10)
iOS10跳转系统设置、WIFI、蓝牙...