【问题标题】:TouchID/Biometrics on iOS 11: LAPolicy.deviceOwnerAuthenticationWithBiometrics results in LAErrorAppBackgrounded without showing promptiOS 11 上的 TouchID/Biometrics:LAPolicy.deviceOwnerAuthenticationWithBiometrics 导致 LAErrorAppBackgrounded 不显示提示
【发布时间】:2017-12-04 18:57:03
【问题描述】:

在 iOS 11 上,当应用程序使用主页按钮在后台运行时,与当它打开外部 webview 链接并进入 safari 时,应用程序状态似乎有所不同。

返回我的应用后,我要求用户使用触控 ID 进行验证。如果应用程序使用主页按钮在后台运行并返回,则对LAPolicy.deviceOwnerAuthenticationWithBiometrics 的调用会显示提示并等待用户交互。但是,用户通过应用程序中的链接访问外部网站,并使用状态栏中显示的“返回应用程序”按钮返回应用程序,调用LAPolicy.deviceOwnerAuthenticationWithBiometrics 会立即导致错误而不显示touch ID 提示。

我检查了调用时两种情况下的应用程序状态是应用程序是active。它是在主线程上完成的,它是在 applicationDidBecomeActive 上完成的。

这是我看到的错误:

Error Domain=com.apple.LocalAuthentication Code=-1004 "User interaction is required." UserInfo={NSLocalizedDescription=User interaction is required.}`

LAPolicy.deviceOwnerAuthenticationWithBiometrics 的行为有任何见解吗?用来调用它的代码是:

        let context = LAContext()
        context.localizedFallbackTitle = ""
        print("--> internalAuthenticateBiometrics background \(UIApplication.shared.applicationState == UIApplicationState.background)")
        context.evaluatePolicy(LAPolicy.deviceOwnerAuthenticationWithBiometrics, localizedReason:NSLocalizedString("Place your finger to sign in.",comment: "")) { [weak self] (success, error) in
            print("--> internalAuthenticateBiometrics completion success \(success) error \(error)")
        }

【问题讨论】:

    标签: ios11 touch-id


    【解决方案1】:

    我们发现这个特定问题发生在旧版本的 iOS 11 上。我们正在运行 iOS 11.0.3 和 11.1.2 的设备上进行测试。我将操作系统更新到 11.4,问题就消失了。

    截至目前,我只能假设 Apple 修复了一些应用前景和生物识别问题。仅供参考,这个问题与背景或覆盖的视图没有任何关系,因为我们确保一切都是可见的,appDidEnterForeground 被调用,viewDidAppear 正在发生,我们甚至在几秒钟后添加了触发生物识别的延迟。

    【讨论】:

      猜你喜欢
      • 2022-11-10
      • 1970-01-01
      • 2018-05-03
      • 2018-06-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多