michaela
michaela

Reputation: 171

Graph API iOS picture

I have a graph api call from my ios application. It looks something like this:

[[appDelegate facebook] requestWithGraphPath:[NSString stringWithFormat:@"%i/picture", [[userData objectForKey:@"id"] intValue] andDelegate:self];

(might be some typos)

But in the request did load when i nslog the result, it is (null). Graph API says that you need to use fields=picture or something to get the url. How would I do this? If it is possible could somebody show me some example code?

Upvotes: 1

Views: 1382

Answers (2)

Joel
Joel

Reputation: 16134

See my answer on this post to see how to get the picture URL using requestWithGraphPath:

iOS Facebook Graph API Profile picture link

Upvotes: 0

Andy Obusek
Andy Obusek

Reputation: 12852

You don't need an actual Graph API call to load a user's facebook picture. Simply construct a url like this, and it will return the specified user's facebook image:

NSURL *fbPictureURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://graph.facebook.com/%@/picture", [userData objectForKey:@"id"]];

You can then do with that what you want, like load it in an UIImageView.

Upvotes: 2

Related Questions