2

我正在使用 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) {} 

我想问我如何修改参数以便它只会返回有限数量的结果?例如,我知道我可以通过编写类似 LIMIT=20 的内容来使用 FQL。由于我没有使用 FQL,如何使用上述代码实现相同的目标?

4

1 回答 1

1

根据文档 应该足够了

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

https://developers.facebook.com/tools/explorer/

在任何情况下它都会返回超过 1 个结果。

于 2013-03-17T07:33:05.223 回答