Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7605587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:12:17+00:00 2026-05-31T00:12:17+00:00

I’m trying to create a RestKit request to load an image from a web

  • 0

I’m trying to create a RestKit request to load an image from a web service and add it to a button as a background image. To do so asynchronously, I’m trying to add the button as a userData to the RKRequest object.

What I’m not sure of is how to send a fully configured RKRequest, I tried setting the delegate, calling prepareURLRequest and sendAsynchronously . The method that I expect to be called back does not get called.

- (void)didFinishLoad:(RKResponse*)response

To check that my request is properly configured, I sent it via a request queue, and that works.

What is the proper way to send fully configured requests with userData object using RestKit?

- (void)sendRequestForTrackerUserGravatar:(CoreDataButton*)coreDataButton {

/*This works, but does not allow the user data object to be set, meaning I don’t know which button’s image was loaded.

    NSMutableDictionary* paramsDictionary = [[NSMutableDictionary alloc] init];   
    [paramsDictionary setValue:@"identicon" forKey:@"d"];

[[RKClient sharedClient] get:[self gravatarMD5HashWithUserID:trackerUser.user_id.intValue] queryParams:paramsDictionary delegate:self];
*/

    //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];
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T00:12:18+00:00Added an answer on May 31, 2026 at 12:12 am

    This line:

    [[RKClient sharedClient] get:[self gravatarMD5HashWithUserID:trackerUser.user_id.intValue] queryParams:paramsDictionary delegate:self];
    

    actually returns the request that is created and then dispatched, so you can do:

    RKRequest* r = [[RKClient sharedClient] get:[self gravatarMD5HashWithUserID:trackerUser.user_id.intValue] queryParams:paramsDictionary delegate:self];
    [r setUserData:buttonReference];
    

    and then catch the success with RKRequest delegate method:

    - (void)request:(RKRequest *)request didLoadResponse:(RKResponse *)response {
        // get button like this
        UIButton* b = [request userData];
        // process the response and get image
        UIImage* i = [UIImage imageWithData:[self giveMeDataFromResponseNOW:response]]; //or however you handle responses
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
Seemingly simple, but I cannot find anything relevant on the web. What is the
I am currently running into a problem where an element is coming back from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.