如果您可以在 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>
fql
所以我相信只需要设置路径requestForGraphPath
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"]
startWithGraphPath
最新的文档虽然显示了下面的示例FBRequestConnection
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";
// Set up the query parameter
NSDictionary *queryParam = @{ @"q": query };
// Make the API request that uses FQL
[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/