我正在使用Facebook iOS SDK从Score中检索数据。
以下是我的代码......
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[NSString stringWithFormat: @"%d", mScore], @"score",
nil];
[FBRequestConnection startWithGraphPath: [NSString stringWithFormat: @"%llu/scores", APP_ID]
parameters: params HTTPMethod:@"GET"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {}
我想问一下如何修改params以便它只返回有限数量的结果?例如,我知道我可以通过编写类似LIMIT = 20的东西来使用FQL。 由于我没有使用FQL,我怎么能用上面的代码实现同样的东西呢?
答案 0 :(得分:1)
根据documentation 它应该足够了
NSInteger limit = 3;
[FBRequestConnection startWithGraphPath: [NSString stringWithFormat: @"%llu/scores?limit=%i", APP_ID, limit];
修改强>
由于上述内容似乎不起作用,您是否尝试在参数中传递限制?
NSInteger limit = 3;
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[NSString stringWithFormat: @"%d", mScore], @"score",
limit, @"limit",
nil];
编辑2
该API似乎存在问题。
我尝试了查询
<APP_ID>/scores?limit=1
on https://developers.facebook.com/tools/explorer/
并且在任何情况下都会返回超过1个结果。