0

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

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

4

1 回答 1

0

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

于 2019-11-01T08:29:40.743 回答