如果有错误欢迎指正。
TOUCHID_PASSCODE这个是跳转到设置中的Touch ID与页面界面,下面这一句代码就行了,首先要在info里的URL Types中设置URL Schemes为prefs。
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=TOUCHID_PASSCODE"]];
这其中App-Prefs要加个App,Prefs首字母大写小写都能跳,不加App会报错,错误是:-canOpenURL: failed for URL: "prefs:root=Bluetooth" - error: "The operation couldn’t be completed. (OSStatus error -10814.)",具体原因我不知道,如果哪位大神知道,可以告诉我,谢谢。
还有iOS10中openURL不能用了,文档里是这样写的- (BOOL)openURL:(NSURL*)url NS_DEPRECATED_IOS(2_0, 10_0, "Please use openURL:options:completionHandler: instead") NS_EXTENSION_UNAVAILABLE_IOS("");要我们用openURL:options:completionHandler:方法代替,当然你继续用openURL也不影响代码运行,只是会有一个警告。在我们的项目中,警告多了也不好,我们要尽量不用,能消除的警告要消除掉
为什么要在Info.plist得URL types里添加URL Schemes为prefs的url呢?因为苹果在iOS5.0后把这个系统自带的URL Schemes删除了
这下面是网上找的跳转到设置其他页面的东西,如果不全,可以自己百度搜。
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
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=TOUCHID_PASSCODE"]];
// //数组中的字典的内容就是直接跳转的语句
// //例如跳转到照片:prefs:root=Photos
// [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=Photos"]];
// //跳转系统设置根目录中的项目使用如下的方法:
// NSArray *array = @[
// @{@"系统设置":@"prefs:root=INTERNET_TETHERING"},
// @{@"WIFI设置":@"prefs:root=WIFI"},
// @{@"蓝牙设置":@"prefs:root=Bluetooth"},
// @{@"系统通知":@"prefs:root=NOTIFICATIONS_ID"},
// @{@"通用设置":@"prefs:root=General"},
// @{@"显示设置":@"prefs:root=DISPLAY&BRIGHTNESS"},
// @{@"壁纸设置":@"prefs:root=Wallpaper"},
// @{@"声音设置":@"prefs:root=Sounds"},
// @{@"隐私设置":@"prefs:root=privacy"},
// @{@"APP Store":@"prefs:root=STORE"},
// @{@"Notes":@"prefs:root=NOTES"},
// @{@"Safari":@"prefs:root=Safari"},
// @{@"Music":@"prefs:root=MUSIC"},
// @{@"photo":@"prefs:root=Photos"}
// ];
// NSURL * url = [NSURL URLWithString:[_array[index] allValues].firstObject];
// [[UIApplication sharedApplication] openURL:url];