문제

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"];
   }];
도움이 되었습니까?

해결책

(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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top