如果您可以在FQL中完成它,那么让它在SDK中工作只是找到正确查询的问题。您的查询
SELECT uid, name,pic_small,pic_big,online_presence FROM user
WHERE online_presence IN ('active') AND uid IN
(SELECT uid2 FROM friend WHERE uid1 = me()) order by name
被执行为graph.facebook.com/fql?q=SELECT uid, name,pic_small,pic_big,online_presence FROM user WHERE online_presence IN ('active') AND uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) order by name
基本上是HTTP GET /fql?q=<QUERY>
所以我相信只需要在requestForGraphPath
中设置路径为fql
FBRequest *fql = [FBRequest requestForGraphPath:@"fql"];
[fql.parameters setObject:@"SELECT uid, name,pic_small,pic_big,online_presence FROM user WHERE online_presence IN ('active') "
@"AND uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) order by name"
forKey:@"q"]
最新的文档显示了在
FBRequestConnection
下有使用
startWithGraphPath
的示例。
NSString *query =
@"SELECT uid, name,pic_small,pic_big,online_presence FROM user WHERE online_presence IN ('active') "
@"AND uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) order by name";
NSDictionary *queryParam = @{ @"q": query };
[FBRequestConnection startWithGraphPath:@"/fql"
parameters:queryParam
HTTPMethod:@"GET"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
if (error) {
NSLog(@"Error: %@", [error localizedDescription]);
} else {
NSLog(@"Result: %@", result);
}
}];
来源:https://developers.facebook.com/docs/howtos/run-fql-queries-ios-sdk/