I checked if user is verified via email or not. However, no matter how many emails I sent and confirm, the verification status is still false
. Am I doing someth
My way to do it was to add a NSNotification.Name.UIApplicationDidBecomeActive
because the user had to leave the app to verify the email:
NotificationCenter.default.addObserver(self,selector:#selector(APEmailVerificationViewController.checkEmailVerificationState),name:NSNotification.Name.UIApplicationDidBecomeActive, object: nil)
Do not forget to remove the notification in viewDidDisappear
. This is the APEmailVerificationViewController.checkEmailVerificationState
func:
FIRAuth.auth()?.currentUser?.reload(completion: { [unowned self] (error) in
if error != nil {
print(error!.localizedDescription)
return
}
if !FIRAuth.auth()!.currentUser!.isEmailVerified {
return
}
/**
Great! We go the playground of the app.
*/
UIAlertView(title: "Hooray", message: "You've successfully verified your email", delegate: nil, cancelButtonTitle: "Ok").show()
APIntent.gotoPlayground()
})
Hope it helps!