app传递了face id和touch id身份验证后,instantiateViewController问题

问题描述 投票:1回答:1

我在页面中添加了“触摸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吗?

swift xcode swift4 xcode10
1个回答
1
投票

问题1:单击touch id或face id按钮后,它不会在应用程序界面中打开HomePage ViewController。为什么?

您可以检查您的navigationController是否为零

print(navigationController ?? "NavigationController is nil")

问题2:你能为这个范围写一个解释吗?触摸id或face验证失败,对吧?

Touch ID或面部ID身份验证失败

问题3:你能为这个范围写一个解释吗? “设备不支持面部ID或触摸ID”,对吧?

Touch ID或FaceID身份验证不可用,可能是用户未设置它

© www.soinside.com 2019 - 2024. All rights reserved.