ios使用touchId,iostouchid
#import <LocalAuthentication/LAContext.h>
LAContext *myContext = [[LAContext alloc] init]; NSError *authError = nil; NSString *myLocalizedReasonString = @"請輸入指紋"; if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) {//判斷是否有指紋識別 [myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:myLocalizedReasonString reply:^(BOOL success, NSError *error) { if (success) { UIAlertView *al = [[UIAlertView alloc]initWithTitle:nil message:@"success" delegate:nil cancelButtonTitle:@"確定" otherButtonTitles: nil]; [al show]; NSLog(@"success"); // User authenticated successfully, take appropriate action } else { UIAlertView *al = [[UIAlertView alloc]initWithTitle:nil message:@"失敗" delegate:nil cancelButtonTitle:@"確定" otherButtonTitles: nil]; [al show]; NSLog(@"faill"); } }]; } else { // Could not evaluate policy; look at authError and present an appropriate message to user }