2010-11-11 77 views
0

我正在使用fbconnect獲取擁有者的Facebook好友列表。對於這個我實現:無法在iPhone應用中獲取Facebook好友列表

FBSession* _session; 
FBLoginButton *loginButton; 

和.m文件:

- (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]); 


    } 
} 

但問題是,結果是零。 我曾嘗試與這些FQL也

SELECT flid, name FROM friendlist WHERE owner =%lld",_session.uid 

SELECT flid, name FROM friendlist WHERE uid ==%lld",_session.uid 

但不成功。

但是,如果我有

select name,pic from user where uid == %lld", session.uid 

它的工作原理更換查詢。

我不明白爲什麼。

回答

0

試試這個:

NSString* fql = [NSString stringWithFormat:@"SELECT uid, name from user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=%lld)", self.usersession.uid]; 
相關問題