I am having issues retrieving an imaged attached to the currentUser. Here is the code I am using to save the info to parse.
-(IBAction)saveButtonAction:(id)sender {
PFUser *currentUserSave = [PFUser currentUser];
userBioString = userBio.text;
genderFieldString = genderField.text;
ageFieldString = ageField.text;
profilePictureData = UIImageJPEGRepresentation(profilePicture.image, .05f);
PFFile *userProfilePictureFileContainer = [PFFile fileWithData:profilePictureData];
currentUserSave[@"userBioParse"] = userBioString;
currentUserSave[@"userGenderParse"] = genderFieldString;
currentUserSave[@"ageFieldParse"] = ageFieldString;
[currentUserSave setObject:userProfilePictureFileContainer forKey:@"userPictureParse"];
userImageData = UIImageJPEGRepresentation(profilePicture.image, 0.5);
userProfileImageFile = [PFFile fileWithData:userImageData];
[currentUserSave setObject:userProfileImageFile forKey:@"userPictureParse"];
[[PFUser currentUser] saveInBackground];
Basically now I'm trying to call the info back to load the users profile. heres what i have so far (not much).
PFQuery *queryUser = [PFUser query];
[queryUser whereKey:@"username" equalTo:[[PFUser currentUser]username]];
[queryUser getFirstObjectInBackgroundWithBlock:^(PFObject *object, NSError *error){
PFFile *theImage = [object objectForKey:[PFUser currentUser][@"userPictrueParse"]];
NSData *imageData = [theImage getData];
UIImage *profileImage = [UIImage imageWithData:imageData];
if (profileImage == nil) {
profilePicture.image = [UIImage imageNamed:@"765-default-avatar.png"];
} else {
profilePicture.image = profileImage;
}
}];
You can use ParseImageView instead of ImageView and set image by following code-