title: iOS RestKit how to send a request with a callback object (userData) set?
body: <p>I'm trying to create a RestKit request <strong>to load an image from a web service and add it to a button as a background image</strong>. To do so asynchronously, I'm trying to add the button as a userData to the RKRequest object. </p>
  
  <p>What I'm not sure of is how to send a fully configured RKRequest, I tried setting the <code>delegate</code>, calling <code>prepareURLRequest</code> and <code>sendAsynchronously</code> . The method that I expect to be called back does not get called.</p>
  
  <pre><code>- (void)didFinishLoad:(RKResponse*)response
  </code></pre>
  
  <p>To check that my request is properly configured, I sent it via a request queue, and that works. </p>
  
  <p><strong>What is the proper way to send fully configured requests with userData object using RestKit?</strong></p>
  
  <pre><code>- (void)sendRequestForTrackerUserGravatar:(CoreDataButton*)coreDataButton {
  </code></pre>
  
  <p>/*This works, but does not allow the user data object to be set, meaning I don't know which button's image was loaded.    </p>
  
  <pre><code>    NSMutableDictionary* paramsDictionary = [[NSMutableDictionary alloc] init];   
      [paramsDictionary setValue:@"identicon" forKey:@"d"];
  </code></pre>
  
  <p>[[RKClient sharedClient] get:[self gravatarMD5HashWithUserID:trackerUser.user_id.intValue] queryParams:paramsDictionary delegate:self];<br>
  */</p>
  
  <pre><code>    //single request for a resource, includes a dictionary of parameters to be appended to the URL
      //    [paramsDictionary setValue:@"retro" forKey:@"d"];
      User* user = (User*)coreDataButton.managedObject;
  
  
      NSString* md5Hash = [self gravatarMD5HashWithUserID:user.user_id.intValue];
      NSString* urlString = [NSString stringWithFormat:@"%@%@?d=identicon",kGravatarWebsite,md5Hash];
      RKRequest* request = [[RKRequest alloc] initWithURL:[NSURL URLWithString:urlString] delegate:self];
      request.userData = coreDataButton;
      request.delegate = self;   
      request.cachePolicy = RKRequestCachePolicyEnabled;
  
  //this works    
  //[[RKRequestQueue sharedQueue] addRequest:request];
  
  
  //this does not seem to call back the delegate method    
      [request prepareURLRequest];
      [request sendAsynchronously];
  
      }
  
  //request callback, does not get called
  - (void)didFinishLoad:(RKResponse*)response
  {
      [self processResponse:response];
  }
  
  //queue callback, DOES get called
  -(void)requestQueue:(RKRequestQueue *)queue didLoadResponse:(RKResponse *)response
  {
      [self processResponse:response];
  }
  </code></pre>