gpt4 book ai didi

ios - iOS Swift 中解析密码重置错误

转载 作者:行者123 更新时间:2023-11-30 14:15:48 25 4
gpt4 key购买 nike

我正在使用下面的代码进行密码重置,如解析文档中声明的: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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com