gpt4 book ai didi

ios - UIAlertViewcontroller 在转到 viewcontroller 之前没有被弹出

转载 作者:搜寻专家 更新时间:2023-11-01 06:34:24 32 4
gpt4 key购买 nike

我希望在注册后弹出警报 Controller ,然后进入 loginFirstViewController 但这不会发生,为什么?它只会转到 loginfirstviewcontroller 而不是弹出警报 Controller

     if error == nil {



FIRAuth.auth()?.currentUser!.sendEmailVerification(completion: { (error) in
})



print("You have successfully signed up")
//Goes to the Setup page which lets the user take a photo for their profile picture and also chose a username




let alertController = UIAlertController(title: "Successful!", message: "Email Verification link sent", preferredStyle: .alert)


let alertActionOkay = UIAlertAction(title: "Okay", style: .default)

let vc = self.storyboard?.instantiateViewController(withIdentifier: "LoginFirstViewController")

self.present(vc!, animated: true, completion: nil)



alertController.addAction(alertActionOkay)

self.present(alertController, animated: true, completion: nil)

}

最佳答案

您直接打开了新的 View Controller 以防止出现这种情况,您应该为 uialertaction 添加完成处理程序。当用户按下确定按钮时,您可以打开其他 View Controller

    let alertController = UIAlertController(title: "Successful!", message: "Email Verification link sent", preferredStyle: .alert)
let alertActionOkay = UIAlertAction(title: "Okay", style: .default) { (action) in
let vc = self.storyboard?.instantiateViewController(withIdentifier: "LoginFirstViewController")
self.present(vc!, animated: true, completion: nil)
}
alertController.addAction(alertActionOkay)
self.present(alertController, animated: true, completion: nil)

关于ios - UIAlertViewcontroller 在转到 viewcontroller 之前没有被弹出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43208684/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com