2011-02-09 4 views
8

क्या किसी ने आईओएस में ग्राफ एपीआई का एफक्यूएल इस्तेमाल किया है? मैं विभिन्न समूहों से उपयोगकर्ताओं की पोस्ट प्राप्त करने का प्रयास कर रहा हूं मैंने FQL दस्तावेज़ पढ़ा है लेकिन मुझे आगे बढ़ने में मेरी सहायता करने के लिए एक उदाहरण देखने की आवश्यकता है? कृपया मददआईओएस में एफक्यूएल और ग्राफ एपीआई

उत्तर

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, विधि बर्ट्रेंड ने उल्लेख में मौजूद नहीं है।

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/

अब आप इसे इस तरह करना चाहिए
संबंधित मुद्दे