Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FQL and Graph API in iOS

have anyone used FQL of graph API in iOS? I am trying to get users posts from different groups I have read FQL documentation but I need to see an example to help me proceed? please help

like image 747
Dina Avatar asked Feb 09 '11 04:02

Dina


2 Answers

Here is an example:

    NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                @"SELECT uid,name FROM user WHERE uid=4", @"query",
                                nil];
[facebook   requestWithMethodName: @"fql.query"
                         andParams: params
                     andHttpMethod: @"POST"
                       andDelegate: self];
like image 159
Bertrand Avatar answered Oct 07 '22 17:10

Bertrand


In the last iOS SDK, the method mentioned by Bertrand doesn't exists. Now you should do it this way:

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

Source: https://developers.facebook.com/docs/howtos/run-fql-queries-ios-sdk/

like image 21
Natan R. Avatar answered Oct 07 '22 18:10

Natan R.