2011-02-09 8 views
8

qualcuno ha utilizzato FQL dell'API del grafico in iOS? Sto cercando di ottenere messaggi degli utenti da diversi gruppi Ho letto la documentazione FQL ma ho bisogno di vedere un esempio per aiutarmi a procedere? favore aiutoAPI FQL e Graph in iOS

risposta

11

Ecco un esempio:

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

Nell'ultimo iOS SDK, il metodo di cui parla Bertrand non esiste. Ora si dovrebbe fare in questo modo:

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

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

Problemi correlati