I think it's very trivial, but i can't figure it out why these codes are incorrect. I want to retrieve one image from the Parse User class. I mean, every user has a profile picture, that i store under the "imageFile" column and i would like to load it to a PFImageView. The upload works correctly, but i'cant retrieve it. The log says error, because there is no matches for the query. The file what i want to retrieve exists, so it's 100% that my query implementation is wrong. I would really appreciate any relevant help, thanks.
Non query version: (all versions are implemented in the viewDidLoad
)
self.userThumbnail.file = self.currentUser.imageFile;
[self.userThumbnail loadInBackground];
query version
PFQuery *queryImage = [PFQuery queryWithClassName:@"User"]; [queryImage whereKey:@"imageFile" equalTo:self.currentUser] [queryImage getFirstObjectInBackgroundWithBlock:^(PFObject *object, NSError *error) { if (error) { NSLog(@"ERROR"); } else { PFFile *file = [object objectForKey:@"imageFile"]; self.userThumbnail.file = file; [self.userThumbnail loadInBackground]; } }];
query version
PFQuery *queryImage = [PFUser query]; [queryImage whereKey:@"imageFile" equalTo:self.currentUser]; [queryImage getFirstObjectInBackgroundWithBlock:^(PFObject *object, NSError *error) { if (error) { NSLog(@"ERROR"); } else { PFFile *file = [object objectForKey:@"imageFile"]; self.userThumbnail.file = file; [self.userThumbnail loadInBackground]; } }];