ios - 应用程序扩展键盘内的 LAContext Touch ID

标签 ios ios-app-extension touch-id

我正在尝试添加 touchid 来解锁自定义键盘扩展的密码保护部分。

当我将此代码添加到自定义键盘扩展的 UIInputViewController 时,它会生成运行时错误

let authContext = LAContext()

错误是:

2015-09-01 22:18:50.524 AS_Custom_KB[21508:2656253] plugin com.example.AS-Custom-KB.AS-Custom-KeyBoard interrupted 2015-09-01 22:18:50.545 AS_Custom_KB[21508:2656253] plugin com.example.AS-Custom-KB.AS-Custom-KeyBoard invalidated 2015-09-01 22:18:51.635 AS_Custom_KB[21508:2656082] viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "The operation couldn’t be completed. (_UIViewServiceInterfaceErrorDomain error 3.)" UserInfo=0x174273f80 {Message=Service Connection Interrupted}

相同的代码在模拟器上运行良好,但由于模拟器不支持 TouchID,所以没有执行任何操作。该代码在常规应用程序(而不是自定义键盘扩展)中也可以正常工作。

我尝试查看 LAContext 文档,但没有找到任何有关它为何可能导致此类错误的信息,也没有找到有关无法从扩展中使用它的任何信息。

关于为什么会发生这种情况,或者如何通过自定义键盘扩展使其正常工作,有什么想法吗?有没有人能够通过自定义键盘扩展让 touchid 工作?

最佳答案

经过24小时的研发,我自己找到了答案,我发现答案非常简单,设置也很简单

NSExtensionAttributes 中设置 RequestsOpenAccess

关于ios - 应用程序扩展键盘内的 LAContext Touch ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35696394/

相关文章:

iphone - 安装旧版 iOS 进行设备测试

android - 我应该选择什么 AWS 开发工具包?

ios - authPlayerWithCompletionHandler 已弃用,那么我该如何使用 authenticateHandler

ios - 启用点击隐藏后,导航 Controller 的工具栏没有被隐藏?

ios - Core Data iOS 8 Today Widget 问题

ios - iOS 应用程序扩展只显示一个名称,而不是 "App - Extension"?

ios - 如何使用 NSLog 调试 iOS 8 扩展?

ios - 使用 Xcode 7、Swift 2 的 TouchID

Android - BiometricPrompt 检测是否是面部识别码或触摸识别码

ios - 本地身份验证不更改 View Controller