我有一个 Parse iOS 应用程序,我希望用户能够使用它来重置其帐户密码。我尝试使用标准解析密码电子邮件重置功能与此代码。但它返回了此错误:“密码重置功能需要 appName、publicServerURL 和 emailAdapter。”。我对此进行了研究,发现我可能需要 MailGun 或其他电子邮件服务来托管我的电子邮件重置。真的吗?或者有其他方法可以解决此错误吗?
PFUser.requestPasswordResetForEmailInBackground(myEmail, block: { (success, error) -> Void in
if error == nil {
print("Password Reset Email Sent")
} else {
print(error)
}
})
最佳答案
//标记:- 忘记密码按钮
@IBAction func forgotPasswButt(_ sender: AnyObject) {
let alert = UIAlertController(title: APP_NAME,
message: "Type your email address you used to register.",
preferredStyle: .alert)
let ok = UIAlertAction(title: "Reset password", style: .default, handler: { (action) -> Void in
// TextField (optional))
let textField = alert.textFields!.first!
let txtStr = textField.text!
PFUser.requestPasswordResetForEmail(inBackground: txtStr, block: { (succ, error) in
if error == nil {
self.simpleAlert("You will receive an email shortly with a link to reset your password")
}})
})
// Cancel button
let cancel = UIAlertAction(title: "Cancel", style: .destructive, handler: { (action) -> Void in })
// Add textField
alert.addTextField { (textField: UITextField) in
textField.keyboardAppearance = .dark
textField.keyboardType = .default
}
alert.addAction(ok)
alert.addAction(cancel)
present(alert, animated: true, completion: nil)
}
关于ios - 解析服务器密码重置电子邮件错误ios,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39887013/