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 8914067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:38:22+00:00 2026-06-15T04:38:22+00:00

I just switched to RestKit 0.2 and I am currently using the new HttpClient

  • 0

I just switched to RestKit 0.2 and I am currently using the new “HttpClient” which is basically a AFHTTPClient. I have this line of code:

RKObjectManager* objectManager = [RKObjectManager sharedManager];
NSDictionary* params = [[NSDictionary alloc] initWithObjectsAndKeys: login, @"username", password, @"password", nil];

[[objectManager HTTPClient]postPath:@"users/login/?format=json" parameters:params
    success:^(AFHTTPRequestOperation *operation, id responseObject)
    {
        //reponseObject vs operation.response
        NSLog(@"%@", responseObject);
    }
    failure:^(AFHTTPRequestOperation *operation, NSError *error)
    {
        NSLog(@"ERROR");
    }];

This POST calls return a JSON response in the form: {“api_key”:”….”,”username”:”….”}. As simple as that.

Before switching to 0.2, I was able to get the api_key key in the response by doing:

 [[RKClient sharedClient] post:@"/users/login/?format=json" usingBlock:^(RKRequest *request)
 {
    request.onDidLoadResponse = ^(RKResponse *response)
    {
        id parsedResponse = [response parsedBody:NULL];
        NSString *apiKey = [parsedResponse valueForKey:@"api_key"];
    }
  }.....];

http://restkit.org/api/master/Classes/RKResponse.html

But now, I can’t do that and if I do a NSLog on the responseObject, I get:

<7b227265 61736f6e 223a2022 41504920 4b657920 666f756e 64222c20 22617069 5f6b6579 223a2022 61356661 65323437 66336264 35316164 39396338 63393734 36386438 34636162 36306537 65386331 222c2022 73756363 65737322 3a207472 75657d>

And the weird thing is that if I do:

        NSLog(@"%@", operation.responseString);

I do have the JSON (in NSString) showing up.

So two questions:

1) Why is printing the responseObject showing me HEX code, and not the actually JSON response?

2) Why if I do operation.responseString it is showing the actual Response Object? Is there a way to get the actual data in ResponseObject after being parsed from the JSON?

  • 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-06-15T04:38:22+00:00Added an answer on June 15, 2026 at 4:38 am

    What you are seeing, if I’m not mistaken, is the raw bytes from the NSData that is given to you when your success block is called.

    The hex you posted reads:

    {"reason": "API Key found", "api_key": "a5fae247f3bd51ad99c8c97468d84cab60e7e8c1", "success": true}

    The reason the second NSLog shows you what you want is that the %@ format string calls the description (correct me if I’m wrong here, SO) of the object you pass it and the NSData probably knows it is a string underneath.

    So, on to how to get the JSON. It is really rather simple. Once you have your response object, you can do something like this:

    NSDictionary* jsonFromData = (NSDictionary*)[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:&error];

    What this will do for you is use return an NSDictionary which encodes the root object in the JSON and then each value in the dictionary will be of the type NSString, NSNumber, NSArray, NSDictionary, or NSNull. See NSJSONSserialization for documentation.

    The NSJSONReadingMutableContainers makes the dictionaries and arrays mutable. It’s just a leftover from my code.

    Hopefully you’re on iOS 5 or later, or you’ll need to find another solution for the parsing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We just switched to our new website redesign. We have a copy of the
I have just switched over from the old png transparency fix using a htc
I just switched groups and what they currently do is have their middle tier
I just switched to the new management portal of Windows Azure (and I really
I just switched to using the CSS Adapters for my TreeView control on one
I just switched my code from Objective-C to Objective-C++. Everything goes swimmingly except for
I just switched from storing my images uploaded via Carrierwave locally to using Amazon
I just switched from Visual Studio 2010 to Eclipse (Ubuntu). I have a global
I just switched to C++ from C# I wrote a link list code in
I have just switched from Java Server Faces JSF 1.x to JSF 2.x. Files

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.