This question already has answers here:
PFUser does not have a member named subscript?
(2个答案)
四年前关闭。
我没有足够的声誉来发布这些图片,
我正在使用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")
        }


    }

最佳答案

这意味着您不能使用下标访问属性image。而不是user["photo"]尝试user.photo

关于ios - 'PFUser'没有名为'subscript'的成员,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32689453/

10-13 04:56