지문 인식 터치 id의 간단한 사용
#import //
- (void)yanzheng
{
LAContext *lac = [[LAContext alloc] init];
BOOL isSupport = [lac canEvaluatePolicy:kLAPolicyDeviceOwnerAuthenticationWithBiometrics error:NULL];
lac.localizedFallbackTitle = NSLocalizedString(@" ", nil);
if (isSupport) {
[lac evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:@" Touch ID" reply:^(BOOL success, NSError * _Nullable error) {
if (success) {
dispatch_async(dispatch_get_main_queue(), ^{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@" " message:@" " delegate:self cancelButtonTitle:@" " otherButtonTitles:nil, nil];
[alert show];
});
}else if([error.userInfo[@"NSLocalizedDescription"] isEqualToString:@"Canceled by user."]){
dispatch_async(dispatch_get_main_queue(), ^{
return ;
});
}else{
dispatch_async(dispatch_get_main_queue(), ^{
[self alertViewWithEnterPassword:YES];
});
}
}];
}else{
NSLog(@" ");
}
}
위의 코드는 검증을 진행하는 관건적인 코드와 판단으로 검증 성공, 검증 실패, 검증 취소를 포함한다.유효성 검사에 실패하면 다음과 같은 암호를 입력하는 프롬프트 상자를 팝업할 수 있습니다.
- (void)alertViewWithEnterPassword:(BOOL)isTrue
{
UIAlertController *alert;
if (isTrue) {
alert = [UIAlertController alertControllerWithTitle:@" " message:@" " preferredStyle:UIAlertControllerStyleAlert];
}else{
alert = [UIAlertController alertControllerWithTitle:@" " message:@" " preferredStyle:UIAlertControllerStyleAlert];
}
[alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
textField.secureTextEntry = YES;
}];
UIAlertAction *backAction = [UIAlertAction actionWithTitle:@" " style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
[self yanzheng];
}];
UIAlertAction *confirmAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
if ([alert.textFields.firstObject.text isEqualToString:@"123"]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@" " message:@" " delegate:self cancelButtonTitle:@" " otherButtonTitles:nil, nil];
[alert show];
}else{
[self alertViewWithEnterPassword:NO];
}
}];
[alert addAction:backAction];
[alert addAction:confirmAction];
[self presentViewController:alert animated:YES completion:nil];
}
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.