'PFUser' 没有名为 'subscript' 的成员
'PFUser' does not have a member named 'subscript'
我没有足够的声誉 post 图片,
我正在使用 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
好的,我知道了!
user.setValue(imageFile, forKey:"photo")
现在可以使用了!!
我没有足够的声誉 post 图片, 我正在使用 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
好的,我知道了!
user.setValue(imageFile, forKey:"photo")
现在可以使用了!!