【问题标题】:Touch id default alert partially hides keyboard from the screenTouch id 默认警报部分隐藏了屏幕上的键盘
【发布时间】:2026-01-26 23:00:01
【问题描述】:

在使用 touch id 验证用户时,弹出窗口会出现在窗口中,但键盘视图已从窗口中部分消失(附件视图不会用键盘关闭)。我添加了截图供您参考

其实我们期待的结果是这样的one

我调用了下面的代码来验证来自 viewDidLoad 函数的用户。如果我们单击身份验证状态之前的文本字段。就会出现问题。

LAContext *context = [[LAContext alloc] init];

context.localizedFallbackTitle = @"";

NSError *error = nil;
if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) {

    // If pass coed set means this loop
    [context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:@“Login With your Touch ID” reply:^(BOOL success, NSError *error) {

      if (error) {
       dispatch_async(dispatch_get_main_queue(), ^{
        // show error message
       });

      return;
      }

     if (success) {
       // allow user to a/c section
     } else {
      // Will add wrong user message
     }

   }];

请帮助我们解决此问题。谢谢!

【问题讨论】:

  • 请提供一些代码sn-p
  • @MaulikBhuptani - 现在,我添加了上面的示例代码供您参考。

标签: ios objective-c uialertview uikeyboard touch-id


【解决方案1】:

为防止这种情况,您应该在viewDidLoad 中使用[self.view setUserInteractionEnabled:false]; 并再次在触摸ID 访问块中使用

dispatch_async(dispatch_get_main_queue(), ^{ [self.view setUserInteractionEnabled:true]; });

您还需要监控设备是否支持 touch id 访问

【讨论】:

  • 好的,谢谢:)