2013-03-17 27 views
2

我使用Facebook iOS SDK從Score中檢索數據。限制我從FBRequestConnection得到的結果

下面是我的代碼...

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,我怎麼能用上面的代碼實現相同的功能?

回答

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]; 

EDIT 2

有似乎與API的問題。

我試着查詢

<APP_ID>/scores?limit=1 

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

而且它在任何情況下返回大於1分的結果。

+0

嗯我試過了,但似乎並不像工作。 我通過1作爲限制,但它仍然返回我多於1結果:( – 2013-03-17 13:29:07

+0

檢查我編輯的答案 – 2013-03-17 16:51:44

+0

是的,我沒有嘗試通過PARAMS的限制,但仍然無法正常工作。:( – 2013-03-18 08:41:24