In my app, when a user signs up, he/she signs up, an image is added to the user class. The code used to do this is...
var newUser = PFUser()
let imageData = UIImagePNGRepresentation(self.imageView.image)
let imageFile = PFFile(data: imageData)
newUser.setObject(imageFile, forKey: "image")
newUser.signUpInBackgroundWithBlock({
(success, error) -> Void in
})
Later in my app, I want to pull that picture to put it into a UIImageView. The way I tried to do it was this.
var user = PFUser.currentUser() //Error on this line
let profileImage = user["image"] as! PFFile
However, this returns the error "AnyObject? is not convertible to PFFile". I would like to know how I can retrieve the file with the key "image" from the user class. Thanks for your help.