You can try this if you want to get the user's friend with profile pictures all at once. First:
- (void) requestFriends:(NSNumber *) fbUserId
{
NSLog(@"requesting friends");
NSString* fql1 = [NSString stringWithFormat:
@"select uid2 from friend where uid1 = %@", fbUserId ];
NSString* fql2 = [NSString stringWithFormat:
@"select uid, name, pic_small from user where uid in (select uid2 from #queryID) order by name"];
NSString* fql = [NSString stringWithFormat:
@"{\"queryID\":\"%@\",\"queryUser\":\"%@\"}",fql1,fql2];
NSLog(fql);
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObject:fql forKey:@"queries"];
[_facebook requestWithMethodName:@"fql.multiquery" andParams:params andHttpMethod:@"GET" andDelegate:self];
}
Then when you get the answer, to process it:
-(void) processFriends:(id) result
{
//NSLog(@"processFriends %@", result);
NSArray *queryResults = (NSArray*) result;
NSMutableDictionary *firstQuery = [queryResults objectAtIndex:0];
NSMutableDictionary *secondQuery = [queryResults objectAtIndex:1];
NSArray *resultSet1 = [firstQuery objectForKey:@"fql_result_set"];
NSString *resultName1 = [firstQuery objectForKey:@"name"];
NSArray *resultSet2 = [secondQuery objectForKey:@"fql_result_set"];
NSString *resultName2 = [secondQuery objectForKey:@"name"];
NSLog(@"%@\n\%@", resultName2, resultSet2);
}
Basically the resultSet2 is an Array of entries that each contain a friend, with these keys in the dictionaries for each friend:
- uid
- name
- pic_small
Therefore you have all you need.
Hope it helps!