0

我有一个要求,比如需要获取正在使用我的应用程序的朋友。与 Instagram 应用程序相同 从 Facebook 查找朋友。

我知道这是提供朋友列表的代码。

- (void) getFriendName :(id) sender {

        self.modeString = @"friendName";

        NSString * query = [NSString stringWithFormat:@"SELECT name FROM user WHERE uid IN (SELECT uid1 FROM friend WHERE uid2=me())",appDelegate.friendList];
        NSLog(@"query :%@",query);
    //    NSString * query = [NSString stringWithFormat:@"SELECT uid, first_name, last_name, birthday_date, sex, pic_square, current_location, hometown_location FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND strlen(birthday_date) != 0 ORDER BY birthday_date",appDelegate.friendList];
        NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                        query, @"query",
                                        nil];
        [_facebook requestWithMethodName:@"fql.query"
                               andParams:params
                           andHttpMethod:@"POST"
                             andDelegate:self];
    } 

在这些好友列表中,我怎样才能只检索使用我的应用程序的好友?

4

2 回答 2

0

如果您在服务器上维护数据,请在服务器端进行 Facebook 集成。

于 2012-08-17T04:49:54.587 回答
0

这是我一直在使用的查询

    NSString *isAppUser = usesApp ? @"1" : @"0";
NSString *query = [NSString stringWithFormat:@"SELECT uid FROM user WHERE is_app_user = %@ AND uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) LIMIT %d",
                   isAppUser, limit];
FBRequest *request = [FBRequest requestWithGraphPath:@"/fql" parameters:@{@"q":query} HTTPMethod:@"GET"];

您可以删除限制,让 isAppUser 始终为 @"1"

于 2014-04-10T01:11:08.340 回答