1.首先去info.plist 設置:

2.代碼
NSURL *url = [NSURL URLWithString:@"App-Prefs:root=TOUCHID_PASSCODE"];
if ([[UIApplication sharedApplication] canOpenURL:url])
{
[[UIApplication sharedApplication] openURL:url];
}
其它設置界面同理,url換成對應系統界面的參數 即可。
3.touch id 代碼示例
- (void)touchID {
LAContext *context = [[LAContext alloc]init];
NSError *error = nil;
if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) {
[context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
localizedReason:@"為了保證數據安全性,必須開啟指紋認證才能使用,謝謝!"
reply:^(BOOL success, NSError *error) {
if (error) {
NSLog(@"操作失敗");
}
if (success) {
NSLog(@"驗證成功");
} else {
NSLog(@"驗證失敗");
}
}];
} else {
NSLog(@"TouchID設備不可用");
}
}
更多參數:
About — App-Prefs:root=General&path=About Accessibility — App-Prefs:root=General&path=ACCESSIBILITY AirplaneModeOn— App-Prefs:root=AIRPLANE_MODE Auto-Lock — App-Prefs:root=General&path=AUTOLOCK Brightness — App-Prefs:root=Brightness Bluetooth — App-Prefs:root=General&path=Bluetooth Date& Time — App-Prefs:root=General&path=DATE_AND_TIME FaceTime — App-Prefs:root=FACETIME General— App-Prefs:root=General Keyboard — App-Prefs:root=General&path=Keyboard iCloud — App-Prefs:root=CASTLE iCloud Storage & Backup — App-Prefs:root=CASTLE&path=STORAGE_AND_BACKUP International — App-Prefs:root=General&path=INTERNATIONAL Location Services — App-Prefs:root=LOCATION_SERVICES Music — App-Prefs:root=MUSIC Music Equalizer — App-Prefs:root=MUSIC&path=EQ Music VolumeLimit— App-Prefs:root=MUSIC&path=VolumeLimit Network — App-Prefs:root=General&path=Network Nike + iPod — App-Prefs:root=NIKE_PLUS_IPOD Notes — App-Prefs:root=NOTES Notification — App-Prefs:root=NOTIFICATIONS_ID Phone — App-Prefs:root=Phone Photos — App-Prefs:root=Photos Profile — App-Prefs:root=General&path=ManagedConfigurationList Reset — App-Prefs:root=General&path=Reset Safari — App-Prefs:root=Safari Siri — App-Prefs:root=General&path=Assistant Sounds — App-Prefs:root=Sounds SoftwareUpdate— App-Prefs:root=General&path=SOFTWARE_UPDATE_LINK Store — App-Prefs:root=STORE Twitter — App-Prefs:root=TWITTER Usage — App-Prefs:root=General&path=USAGE VPN — App-Prefs:root=General&path=Network/VPN Wallpaper — App-Prefs:root=Wallpaper Wi-Fi — App-Prefs:root=WIFI Setting—App-Prefs:root=INTERNET_TETHERING
