我正在使用下面的代码进行密码重置,如解析文档中声明的:https://parse.com/docs/ios/guide#users-resetting-passwords 但是我收到错误:“无法使用类型为 (string (bool!,nserror!)->Void) 的参数调用“requestPasswordResetForEmailInBackground”
我使用的代码是:
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)
}
}
最佳答案
在新的解析API中,错误更改为可选
值,使用如下:
PFUser.requestPasswordResetForEmailInBackground(emailVar) {
(success: Bool, error: NSError?) -> Void in
}
关于ios - iOS Swift 中解析密码重置错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31200978/