无法将类型 (PFUser!, NSError) void 的值转换为预期的参数类型 PFUserResultBlock [英] Cannot convert value of type (PFUser!, NSError) void to expected argument type PFUserResultBlock
本文介绍了无法将类型 (PFUser!, NSError) void 的值转换为预期的参数类型 PFUserResultBlock的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是 swift 和编程的新手,但我正在尝试检索用户是否可以登录的检查,我相信我做了 Parse 建议做的事情,但是我收到了这个错误并且不确定为什么.这是我的代码
I am new to swift as well as programming but I am trying to retrieve check if a user can log in and I believe I did what Parse recommends to do to do so however I am receiving this error and am unsure as to why. Here is my code
PFUser.logInWithUsernameInBackground(usernameTextField.text!, password: passwordTextField.text!){
(user: PFUser!, error: NSError) -> Void in
if user != nil {
//Yes User Exists
self.messageLabel.text = "User Exists"
}
else {
//no user doesnt exist
}
}
推荐答案
我更新了 8.1 版的 xcode,Parse 开始出现同样的错误.
I updated the xcode for version 8.1 and Parse started giving the same error.
我更改了对方法的调用以返回工作.这是我在这里做的:
I changed the call to the method to return to work. Here's how I did here:
PFUser.logInWithUsername (inbackground: usernameTextField.text !, password: passwordTextField.text !, block: {(user, error) in
if user != nil {
//Yes User Exists
self.messageLabel.text = "User Exists"
}
else {
//no user doesnt exist
}
})
这篇关于无法将类型 (PFUser!, NSError) void 的值转换为预期的参数类型 PFUserResultBlock的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文