2011-02-09 10 views
8

¿Alguien ha usado FQL de API gráfica en iOS? Estoy tratando de obtener mensajes de usuarios de diferentes grupos He leído la documentación FQL pero necesito ver un ejemplo para ayudarme a continuar? favor ayudaAPI FQL y Graph en iOS

Respuesta

11

Aquí se muestra un ejemplo:

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

En el último SDK de iOS, el método mencionado por Bertrand qué no existe. Ahora usted debe hacerlo de esta manera:

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

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

Cuestiones relacionadas