我有一个要求,需要获取正在使用我的应用程序的朋友。与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];
}
在这些朋友列表中,如何使用我的应用程序仅检索朋友?
答案 0 :(得分:0)
如果要在服务器上维护数据,请在服务器端进行Facebook集成。
答案 1 :(得分: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”