Swift-仅在TouchID认证后才进行Segue

时间:2019-02-05 18:28:09

标签: segue

带有更改根视图控制器的代码:

let contexta:LAContext = LAContext()

        if contexta.canEvaluatePolicy(.deviceOwnerAuthentication, error: nil){
            contexta.evaluatePolicy(LAPolicy.deviceOwnerAuthenticationWithBiometrics, localizedReason: "Please use TouchID") { (good, error) in
                if good{


                    DispatchQueue.main.async{
                    self.navigationController?.popViewController(animated: true)

                        self.dismiss(animated: true, completion: nil)


                        let appDelegate = UIApplication.shared.delegate! as! AppDelegate

                        let initialViewController = self.storyboard!.instantiateViewController(withIdentifier: "myTabbarControllerID")
                        appDelegate.window?.rootViewController = initialViewController
                        appDelegate.window?.makeKeyAndVisible()
                    }

代码正在处理有关AppDelegate的问题。

2 个答案:

答案 0 :(得分:1)

带有segue的代码按预期工作。

答案 1 :(得分:0)

在继续加载登录屏幕的AppDelegate中显示代码。谢谢您的帮助!