作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
首先,为什么每个应用程序都“启用”了touch id而不是face id。因此,如果您设置了触摸 ID,则每个应用都可以使用它,但面容 ID 需要用户为每个应用接受它。
如何查找用户是否为我的应用启用了面容 ID。
这是我用来找出认证类型的代码
let hasAuthenticationBiometrics = myContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: nil)
let hasAuthentication = myContext.canEvaluatePolicy(.deviceOwnerAuthentication, error: nil)
if #available(iOS 11.0, *) {
if hasAuthentication {
if hasAuthenticationBiometrics {
switch myContext.biometryType {
case .none: return .none
case .faceID: return .faceID // Find out if it is enabled
case .touchID: return .touchID
}
} else {
return .passcode
}
} else {
return .none
}
} else {
if hasAuthentication {
if hasAuthenticationBiometrics {
return .touchID
} else {
return .passcode
}
} else {
return .none
}
}
如果用户有面部识别码但在我的应用程序中禁用了它,即使我的应用程序使用密码进行了身份验证,我总是会得到他“有”面部识别码?
最佳答案
找到答案,你使用错误指针来找出用户是否禁用了面部识别。
var error: NSError?
let hasAuthenticationBiometrics = myContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error)
let hasAuthentication = myContext.canEvaluatePolicy(.deviceOwnerAuthentication, error: nil)
if #available(iOS 11.0, *) {
if hasAuthentication {
if hasAuthenticationBiometrics {
switch myContext.biometryType {
case .none: return .none
case .faceID: return error?.code == -6 ? .passcode : .faceID // If user disabled face id in settings use passcode
case .touchID: return .touchID
}
} else {
return .passcode
}
} else {
return .none
}
}
关于ios - 如何知道是否启用了面容 ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53778941/
我已经为我的应用程序集成/实现了面容 ID(本地身份验证)身份验证,一切正常,除了面容 ID 提示警报窗口界面。 It shows, a rounded square with a light gra
自从我拿到 iPhone X 后,我一直在更新我的应用程序以使用面容 ID。当 Face ID 失败太多次时,我会收到文本“无法识别面部”“输入您的密码”。我遇到的问题是,对于此提示,我不想执行回退操
我是一名优秀的程序员,十分优秀!