我正在使用以下代码进行密码重置,如解析文档中所声明:https://parse.com/docs/ios/guide#users-resetting-passwords 但是我收到错误:“无法调用”requestPasswordResetForEmailInBackground“,其参数类型为(string(bool!,nserror!) - > Void)
我使用的代码是:
var emailVar = emailField.text
PFUser.requestPasswordResetForEmailInBackground(emailVar) { (success: Bool, error: NSError!) -> Void in
if (error == nil) {
let alertView = UIAlertController(title: "Password recovery e-mail sent", message: "Please check your e-mail inbox for recovery", preferredStyle: .Alert)
alertView.addAction(UIAlertAction(title: "Ok", style: .Default, handler: nil))
self.presentViewController(alertView, animated: true, completion: nil)
}else {
let alertView = UIAlertController(title: "Could not found your e-mail", message: "There is no such e-mail in our database", preferredStyle: .Alert)
alertView.addAction(UIAlertAction(title: "Ok", style: .Default, handler: nil))
self.presentViewController(alertView, animated: true, completion: nil)
}
}
答案 0 :(得分:0)
在新的解析api中,错误更改为optional
值,使用类似:
PFUser.requestPasswordResetForEmailInBackground(emailVar) {
(success: Bool, error: NSError?) -> Void in
}