我创建了一个iOS应用,使用Firebase电子邮件和密码身份验证。因此,我实现了编码,效果很好。现在,我想发送一封确认邮件以验证其注册电子邮件地址。 这是我的实现:
Auth.auth().createUser(withEmail: email, password: pwd) { result, error in
if let error = error {
print("Failed to authenticate user: ", error)
return
} else {
Auth.auth().currentUser?.sendEmailVerification(completion: { error in
if let error = error {
print("Failed to send user verification email: ", error)
}
}
没有错误发生,但是也没有发送电子邮件。
当我尝试启动密码重置时,行为相同。这是我的代码:
let actionCode = ActionCodeSettings()
Auth.auth().sendPasswordReset(withEmail: email, actionCodeSettings: actionCode) { error in
if let error = error {
print("Failed to reset Password: ", error)
return
} else {
print("Password recovery request successful!")
}
}
我还尝试从Firebase控制台重置密码。另外,这里没有邮件发送,或者我没有收到任何邮件。邮件也没有被过滤为垃圾邮件。真是绝望。我在做什么错了?