I want my swift App to check if the Email Adress is verified, but on the "waiting screen" are buttons, that won't work, when performing a while loop with the request. How can I solve this?
I already tried by dispatchingQueue, but unfortunately you cannot do performSegue on another Thread.
class VerifyEmailViewController: UIViewController {
@IBOutlet weak var mailgif: FLAnimatedImageView!
@IBOutlet weak var Restart: UIButton!
@IBAction func ResendMail(_ sender: Any) {
Auth.auth().currentUser?.sendEmailVerification()
}
@IBAction func DeleteAccount(_ sender: Any) {
Auth.auth().currentUser?.delete()
performSegue(withIdentifier: "RestartSignUp", sender: nil)
}
override func viewDidAppear(_ animated: Bool) {
if Auth.auth().currentUser?.isEmailVerified == true {
performSegue(withIdentifier: "EmailVerified", sender: nil)
}
else{
Auth.auth().currentUser?.sendEmailVerification { (error) in
// ...
print("check for email verified")
while Auth.auth().currentUser?.isEmailVerified != true {
Auth.auth().currentUser?.reload()
sleep(3)
}
print("Performing Segue")
self.performSegue(withIdentifier: "EmailVerified", sender: nil)
}
}
}
override func viewDidLoad() {
super.viewDidLoad()
}
}
question from:
https://stackoverflow.com/questions/66061222/checking-for-email-verification-in-background 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…