Search code examples
iosfacebook-graph-apifacebook-ios-sdk

How to know which request a FB Graph's response respond to?


I make a call to FB graph api using FB IOS and handle the response in a delegate object which conforms to FBRequestDelegate. The handle functions is

- (void)request:(FBRequest *)request didLoad:(id)result;

My question is that how do I know which request this response respond to if two requests with same graph path are made?

Look into FBRequest

@interface FBRequest : NSObject {
    id<FBRequestDelegate> _delegate;
    NSString*             _url;
    NSString*             _httpMethod;
    NSMutableDictionary*  _params;
    NSURLConnection*      _connection;
    NSMutableData*        _responseText;
    FBRequestState        _state;
    NSError*              _error;
    BOOL                  _sessionDidExpire;
}

is there any of these instance variable can be used to distinguish between requests with same graph path?

Thanks


Solution

  • you can check the request url .. im currently dealing with it like this .. for example

     if([request.url rangeOfString:@"me/feed"].location !=NSNotFound)
    {
       //Do something
    }
    else if([request.url rangeOfString:@"fql.query"].location !=NSNotFound)
    {
       //Do something
    }