'PFUser'没有名为'下标'的成员

时间:2015-09-21 07:20:26

标签: ios xcode swift ios8

我没有足够的声誉来发布图片, 我正在使用Parse进行注册,它显示我'PFUser'没有名为'subscript'的成员错误

请检查以下代码

var user = PFUser()
    user.username = usernameTextField.text
    user.email = emailTextField.text
    user.password = passwordTextField.text

    let imageData = UIImagePNGRepresentation(self.profileImage.image)
    let imageFile = PFFile(name: "profilePhoto.png", data: imageData)
    user["photo"] = imageFile -> [error in this line]


    user.signUpInBackgroundWithBlock { (succeeded, error) -> Void in

        if error == nil {
            println("Signup Successful")

        }
        else {
            println("Signup Failed")
        }


    }

2 个答案:

答案 0 :(得分:1)

这意味着您无法使用下标访问属性"DBSnapshotIdentifier : rds:xyz-new-2015-08-17-03-43" -split "DBSnapshotIdentifier : " 。而不是image尝试user.photo

答案 1 :(得分:1)

好的,我明白了!

        user.setValue(imageFile, forKey:"photo")

现在有效!!