I am using fbconnect to get list of owner's facebook friends. For this I am implementing:
FBSession* _session;
FBLoginButton *loginButton;
and in .m file:
- (void)session:(FBSession*)session didLogin:(FBUID)uid {
NSLog(@"User with id %lld logged in.", uid);
[self getFriendsName];
}
-(void)getFriendsName
{
NSString* fql = [NSString stringWithFormat:@"SELECT flid, name FROM friendlist WHERE owner ==%lld",_session.uid];
NSLog(@"the query is %@",fql);
NSDictionary* params =[NSDictionary dictionaryWithObject:fql forKey:@"query"];
[[FBRequest requestWithDelegate:self] call:@"facebook.fql.query" params:params];
}
- (void)sessionDidNotLogin:(FBSession*)session {
}
- (void)sessionDidLogout:(FBSession*)session {
}
- (void)request:(FBRequest*)request didLoad:(id)result {
if ([request.method isEqualToString:@"facebook.fql.query"]) {
NSArray* users = result;
NSLog(@"the response is %@",[users description]);
}
}
But the problem is result is nil. I have tried with these fql also
SELECT flid, name FROM friendlist WHERE owner =%lld",_session.uid
and
SELECT flid, name FROM friendlist WHERE uid =开发者_JAVA技巧=%lld",_session.uid
but in vain.
But if I replace the query with
select name,pic from user where uid == %lld", session.uid
it works.
I am not getting the reason.
Try this:
NSString* fql = [NSString stringWithFormat:@"SELECT uid, name from user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=%lld)", self.usersession.uid];
精彩评论