无法将类型(PFUser !, NSError)的值转换为预期的参数类型PFUserResultBlock [英] Cannot convert value of type (PFUser!, NSError) void to expected argument type PFUserResultBlock

查看:80
本文介绍了无法将类型(PFUser !, NSError)的值转换为预期的参数类型PFUserResultBlock的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不熟悉编程,但是我想检索用户是否可以登录,我相信我已经按照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)的值转换为预期的参数类型PFUserResultBlock的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆