大家好,我正在使用Swift 4制作注册表并使用Firebase。
我一直在重设密码。每当我单击“忘记密码”按钮时,我都会得到一个带有textField的弹出窗口以填写我的电子邮件地址。但是当我点击时,什么也没有发生。在下面发布代码,如果有人有什么想法可能有什么问题
@IBAction func forgotPasswordTapped(_ sender: Any) {
let forgotPasswordAlert = UIAlertController(title: "Forgot password?", message: "Enter email address", preferredStyle: .alert)
forgotPasswordAlert.addTextField { (textField) in
textField.placeholder = "Enter email address"
}
forgotPasswordAlert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
forgotPasswordAlert.addAction(UIAlertAction(title: "Reset Password", style: .default, handler: { (action) in
let resetEmail = forgotPasswordAlert.textFields?.first?.text
Auth.auth().sendPasswordReset(withEmail: resetEmail!, completion: { (error) in
if error != nil{
let resetFailedAlert = UIAlertController(title: "Reset Failed", message: "Error: \(String(describing: error?.localizedDescription))", preferredStyle: .alert)
resetFailedAlert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
self.present(resetFailedAlert, animated: …Run Code Online (Sandbox Code Playgroud)