I've been playing around with the iOS Facebook SDK and I'm getting a bit stuck. Currently when my view is loaded I call:
[self.facebook requestWithGraphPath:kFBGraphPathNewsFeed andDelegate:self];
My delegate for FBRequest looks like this:
- (void)request:(FBRequest *)request didLoad:(id)result
{
if ([result isKindOfClass:[NSDictionary class]]) {
self.newsItems = [result objectForKey:kFBKeyData];
[self.tableView reloadData];
}
}
All of this is working fine. My table's cells can load messages and user's names from the newsItems array. Now I'm trying to load user's pictures. I have tried requesting the graph path for each user's picture (based on their ID) as each cell is displayed like so:
NSString *fromIDPictureGraphPath = [userID stringByAppendingFormat:@"/picture"];
[self.facebook requestWithGraphPath:fromIDPictureGraphPath andDelegate:self];
User ID is already declared in that example. The problem then is that I have to wait for request:didLoad until I can get that user's picture, and then I have no way to assign it back to that cell.
My main question is, is there a way to make the app wait and get the Facebook graph request back inline, rather than using a separate method? Do I possibly have to use FQL, rather than the graph API? Am I looking at the whole thing wrong somehow? Any help would be great.
It you simply want to get the profile picture of the user, you can just use this link:
http://graph.facebook.com/_userID_/picture
This will return the profile picture link of the user