在 iOS Swift 中解析密码重置错误
Parse Password Reset Error in iOS Swift
我正在使用下面的代码重置密码,如解析文档中所述:https://parse.com/docs/ios/guide#users-resetting-passwords
但是我收到错误: "cannot invoke "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)
}
}
在新的解析中 api 错误更改为 optional
值,使用方式如下:
PFUser.requestPasswordResetForEmailInBackground(emailVar) {
(success: Bool, error: NSError?) -> Void in
}
我正在使用下面的代码重置密码,如解析文档中所述:https://parse.com/docs/ios/guide#users-resetting-passwords 但是我收到错误: "cannot invoke "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)
}
}
在新的解析中 api 错误更改为 optional
值,使用方式如下:
PFUser.requestPasswordResetForEmailInBackground(emailVar) {
(success: Bool, error: NSError?) -> Void in
}