开发者

Unable to fetch list of facebook friends in iPhone app

开发者 https://www.devze.com 2023-01-25 02:58 出处:网络
I am using fbconnect to get list of owner\'s facebook friends. For this I am implementing: FBSession* _session;

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];
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号