Reputation: 698
I'm having an issue retrieving the a profile picture from a PFFile column in the Parse User class. I read in the docs that you need to use the PFUser
object to query the User
class. Right now no image is showing up. Here is my code:
PFUser *user = [PFQuery getUserObjectWithId:[PFUser currentUser].objectId];
[user fetchIfNeededInBackgroundWithBlock:^(PFObject *object, NSError *error) {
_profileImage.file = [object objectForKey:@"profilePicture"];
}];
Upvotes: 0
Views: 460
Reputation: 37290
(1) The current user's PFUser object is in fact [PFUser currentUser] so all that code in your first line could be replaced with:
PFUser *user = [PFUser currentUser];
(2) Everything else looks OK, but if you're using a PFImageView, your [profileImage loadInBackground]; call should also be within the fetchIfNeededInBackgroundWithBlock: async block.
Upvotes: 2