I have added a "touch id or face id" button in my page. I have created an action for this button: btnTouchIdOrFaceIdIsPressed
. Question 1: It does not open the HomePageViewController
in the app screen after I click on touch id or face
id button. Why?
@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)
}
}
Can you also reply question 2 and question 3 please?
Question1: It does not open the HomePageViewController in the app screen after I click on touch id or face id button. Why?
You can check if your navigationController is not nil
print(navigationController ?? "NavigationController is nil")
Question2: Can you write an explanation for this scope? Touch id or face is authentication is failed, right?
Touch ID or face ID authentication is failed
Question3: Can you write an explanation for this scope? "device does not support face id or touch id", right?
Touch ID or FaceID authentication is unavailable, may be user does not set it