【问题标题】:The condition for choosing the type of authentication does not work选择认证类型的条件不起作用
【发布时间】:2020-02-27 10:55:45
【问题描述】:

我无法获得有关使用此代码支持任何类型身份验证的价值:

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 上测试

【问题讨论】:

    标签: swiftui xcode11 localauthentication


    【解决方案1】:

    您必须在应用的 Info.plist 文件中包含 NSFaceIDUsageDescription 密钥才能使用生物特征验证。

    【讨论】:

    • 我用这个key,但是用户在打开应用时没有请求faceid权限
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-02
    • 2018-01-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多