Seg没有在ViewDidLoad / ViewDidAppear中开始

时间:2018-05-01 17:09:18

标签: ios swift

我尝试在我的ViewDidLoad / ViewDidAppear方法中运行Segue。我在两种方法中尝试过但它没有用。请参阅我附带的代码:

      super.viewDidAppear(false)
    Auth.auth().addStateDidChangeListener { auth, user in
        if (user?.isEmailVerified)!{
            print("started")
            self.performSegue(withIdentifier: "gotoMoin", sender: nil)
        }else  {

        }
    }
}

邮件已经过验证,因此我获得了“已启动”输出

1 个答案:

答案 0 :(得分:0)

我使用以下代码解决了它:

 let user = Auth.auth().currentUser
    if (user?.isEmailVerified)!{
        self.performSegue(withIdentifier: "gotoMoin", sender: nil)
    }else{
        Auth.auth().currentUser?.reload()
    }
}