swiftui - 选择认证类型的条件不起作用
问题描述
我无法获得有关使用此代码支持任何类型身份验证的价值:
import SwiftUI
import LocalAuthentication
struct SecurityOption: View {
let context = LAContext()
var body: some View {
Form {
if (context.biometryType == .faceID) {
Section(header: ){
}
}
}
if (context.biometryType == .touchID) {
Section(header: ){
}
}
}
if (context.biometryType == .none) {
}
我想根据设备上的身份验证类型在表单中显示特定部分,但 .none 会不断触发。在带有 iOS 13.2 的真实 iPhone X 上测试
解决方案
您必须NSFaceIDUsageDescription
在应用程序Info.plist
文件中包含密钥才能使用生物特征验证。
推荐阅读
- java - Maven 构建失败
- r - 鼠标中的错误:pool():不再适用于 censReg/tobit(“此列表无法识别浏览方法”)
- swift - 隐藏的导航栏和更改的应用程序流程 - 迅速
- java - recyclerview根据item数执行次数时Android bundle值为null
- mongodb - 基于时间的数据的MongoDB索引策略
- r - 计算R中多列的行数
- c# - PDF-为什么有时单词的宽度是高度,而高度是宽度?
- python - 在 Python 中调用函数时,如何在不使用所需位置参数的情况下让用户输入值?
- javascript - 类似于 v-if 的自定义指令
- javascript - 使用过渡对背景图像进行灰度化