Search code examples
iphonefbconnect

Getting 10 friends from friend-list problem in fbconnect problem


I am trying to fetch 10 friends list using fbconnect my query is like this,

NSString* fql = [NSString stringWithFormat:@"select uid from user where uid == %lld LIMIT 1,10", _session.uid];

NSDictionary* params = [NSDictionary dictionaryWithObject:fql forKey:@"query"];

[FBRequest requestWithDelegate:self] call:@"facebook.friends.get" params:params];

But it's fetching all the friends list, Anyone help me....


Solution

  • NSString* fql =[NSString stringWithFormat:@"SELECT uid,name FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = %lld) LIMIT 1,10",_session.uid]; 
    
    NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                    fql, @"query",
                                    nil];
    
    [_facebook requestWithMethodName: @"fql.query" 
                           andParams: params
                       andHttpMethod: @"POST" 
                         andDelegate: self];