8
有沒有人在iOS中使用圖API的FQL? 我正在嘗試從不同羣組獲得用戶帖子 我已閱讀FQL文檔 但我需要看一個示例來幫助我繼續? 請幫助iOS中的FQL和Graph API
有沒有人在iOS中使用圖API的FQL? 我正在嘗試從不同羣組獲得用戶帖子 我已閱讀FQL文檔 但我需要看一個示例來幫助我繼續? 請幫助iOS中的FQL和Graph API
下面是一個例子:
NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"SELECT uid,name FROM user WHERE uid=4", @"query",
nil];
[facebook requestWithMethodName: @"fql.query"
andParams: params
andHttpMethod: @"POST"
andDelegate: self];
在過去的iOS SDK,伯特蘭提到的方法不存在。現在,你應該這樣來做:
NSString *query = [NSString stringWithFormat:@"YOUR_QUERY_HERE"]; //begins from SELECT........
NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
query, @"q",
nil];
FBRequest *request = [FBRequest requestWithGraphPath:@"/fql" parameters:params HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
//do your stuff
}];
//or you can do it also with the following class method:
[FBRequestConnection startWithGraphPath:@"/fql" parameters:params HTTPMethod:@"GET" completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
//do your stuff
}];
來源:https://developers.facebook.com/docs/howtos/run-fql-queries-ios-sdk/