FQL和Graph API在iOS中的应用

8

有人在iOS中使用过图形API的FQL吗? 我正在尝试从不同的群组中获取用户帖子 我已经阅读了FQL文档 但我需要看一个示例来帮助我继续进行? 请帮忙。

2个回答

11

这里有一个例子:

    NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                @"SELECT uid,name FROM user WHERE uid=4", @"query",
                                nil];
[facebook   requestWithMethodName: @"fql.query"
                         andParams: params
                     andHttpMethod: @"POST"
                       andDelegate: self];

8
在最新的iOS SDK中,Bertrand提到的方法已不存在。现在你应该这样做:
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/

本文介绍了如何在iOS应用中执行Facebook Query Language (FQL) 查询。FQL是一种强大的查询语言,可以通过API调用来访问Facebook的数据。使用iOS SDK可以轻松地将FQL查询集成到您的应用程序中。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接