我在页面中添加了“触摸ID或面部ID”按钮。我为此按钮创建了一个动作:btnTouchIdOrFaceIdIsPressed
。问题1:单击HomePageViewController
id按钮后,它没有在应用程序屏幕中打开touch id or face
。为什么?
@IBAction func btnTouchIdOrFaceIdIsPressed(_ sender: UIButton) {
self.useBiometricAuthentication()
}
func useBiometricAuthentication () {
let context = LAContext()
var error : NSError?
let reason = "some message for app user for the touch id or face id.."
if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) {
context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: reason) { (success, error) in
if success {
self.callMeAfterSuccessLoginAction()
} else {
//Question2: Can you write an explanation for this scope? Touch id or face is authentication is failed, right?
}
}
} else {
//Question3: Can you write an explanation for this scope? "device does not support face id or touch id", right?
}
}
func callMeAfterSuccessLoginAction() {
DispatchQueue.main.async {
let oHomepageViewController = self.storyboard?.instantiateViewController(withIdentifier: "Homepage") as! HomepageViewController
self.navigationController?.setViewControllers([oHomepageViewController], animated: true)
}
}
您还可以回答问题2和问题3吗?
答案 0 :(得分:1)
问题1:它无法在应用程序中打开HomePageViewController 单击触摸ID或面部ID按钮后的屏幕。为什么?
您可以检查您的navigationController是否不为空
Throwable
问题2:您能为此范围写一个解释吗?触摸ID或面部认证失败,对吗?
触摸ID或面部ID身份验证失败
问题3:您能为此范围写一个解释吗? “设备不支持面部识别或触摸识别”,对吗?
Touch ID或FaceID身份验证不可用,可能是用户未设置