Firebase电子邮件验证不验证帐户

Firebase电子邮件验证不验证帐户,第1张

Firebase电子邮件验证不验证帐户

我如何实现此功能的方法是添加一个

NSTimer
带有时间间隔的,它将检查用户是否已通过验证,然后在完成验证后终止计时器。

var verificationTimer : Timer = Timer()    // Timer's  Global declarationself.verificationTimer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(LoginViewController.checkIfTheEmailIsVerified) , userInfo: nil, repeats: true)

检查您当前用户状态的功能:

func checkIfTheEmailIsVerified(){    FIRAuth.auth()?.currentUser?.reload(completion: { (err) in        if err == nil{ if FIRAuth.auth()!.currentUser!.isEmailVerified{     let feedVCScene = self.navigationController?.storyboard?.instantiateViewController(withIdentifier: "ViewControllerVC_ID") as! ViewController     self.verificationTimer.invalidate()     //Kill the timer     self.navigationController?.pushViewController(feedVCScene, animated: true)     // Segueing to the next view(i prefer the instantiation method). } else {     print("It aint verified yet") }        } else { print(err?.localizedDescription)        }    })}


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5505928.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-13
下一篇 2022-12-13

发表评论

登录后才能评论

评论列表(0条)

保存