在iOS Swift中解析密码重置错误

在iOS Swift中解析密码重置错误,ios,swift,parse-platform,password-recovery,Ios,Swift,Parse Platform,Password Recovery,我使用下面的代码进行密码重置,如解析文档中声明的: 但是我得到了一个错误:“无法使用类型为(string(bool!,nserror!)->Void)的参数调用”RequestPasswordResetForMailinBackground“ 我使用的代码是: var emailVar = emailField.text PFUser.requestPasswordResetForEmailInBackground(emailVar) { (success: Bool, error:

我使用下面的代码进行密码重置,如解析文档中声明的: 但是我得到了一个错误:“无法使用类型为(string(bool!,nserror!)->Void)的参数调用”RequestPasswordResetForMailinBackground“

我使用的代码是:

  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

}