Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User.getPicture() always returns null? #224

Closed
munwaikong opened this issue Apr 22, 2015 · 3 comments
Closed

User.getPicture() always returns null? #224

munwaikong opened this issue Apr 22, 2015 · 3 comments
Assignees
Milestone

Comments

@munwaikong
Copy link

Looking at User.java, line 246:

@Facebook("picture")
private JsonObject rawPicture;

  /**
   * The user's picture, if provided
   * 
   * @return the user's picture as picture object
   * @since 1.6.16
   */
@Getter
@Setter
private Picture picture;

Would getPicture() in this case always return null?

@nbartels
Copy link
Contributor

If you look at line 916 in the User.java, you find a "postprocessing" method. The rawPicture is analyzed there and a Picture object should be put into the picture field.

Perhaps you can provide me your json, so I can write a unit test and check where's the problem.

@nbartels
Copy link
Contributor

I just checked this with the graph api explorer and I think I know the problem.

If I call /me there's no picture field in the returned JSON. I have to explicitly tell Facebook, to return this field. So I call /me?fields=picture and the returned JSON contains the picture field. And the structure is just the same as in our unit tests. 😄

Hope this helps ...

@nbartels nbartels self-assigned this Apr 22, 2015
@munwaikong
Copy link
Author

Perfect - that was the issue.

Perhaps adding in the comments of the fields to remind users that they'll need to request the field manually.

Thanks!

@nbartels nbartels added this to the 1.10.1 milestone Apr 23, 2015
@restfb restfb locked and limited conversation to collaborators May 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants