0

如果我按下取消并设置[buttonTouch setHidden:NO];为出现,则进行身份验证后,该按钮不会立即出现,尽管按钮事件正在运行,但需要很长时间才能出现。

我的代码:

if ([context canEvaluatePolicy: LAPolicyDeviceOwnerAuthenticationWithBiometrics error:nil]){
        NSLog(@"TouchID Available!");

        [context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:@"Authenticate for server login" reply:^(BOOL success, NSError *authenticationError){
            if (success) {
                [self dismissViewControllerAnimated:YES completion:nil];
                //[self VerifyUserInfo:YES];
                NSLog(@"Fingerprint validated.");
            }else{
                NSLog(@"Fingerprint validation failed: %@.", authenticationError.localizedDescription);
                switch (authenticationError.code) {
                    case LAErrorAuthenticationFailed:
                        [self AlertsMessage:@"Authentication is failed"];
                        NSLog(@"Authentication Failed");
                        break;

                    case LAErrorUserCancel:
                        [buttonTouch setHidden:NO];
                        NSLog(@"User pressed Cancel button");
                        break;

                    case LAErrorUserFallback:
                        [buttonTouch setHidden:NO];
                        NSLog(@"User pressed \"Enter Password\"");
                        break;

                    default:
                        [self AlertsMessage:@"Touch ID is not configured"];
                        NSLog(@"Touch ID is not configured");
                        break;
                }

                NSLog(@"Authentication Fails");
            }
        }];
4

1 回答 1

1

称呼

 dispatch_async(dispatch_get_main_queue(), ^{

                [buttonTouch setHidden:NO];

            });
于 2014-12-12T11:56:24.443 回答