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

  • Home
  • SEARCH
  • 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 7026639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:08:39+00:00 2026-05-28T00:08:39+00:00

I have a small app using RestKit with a Sinatra-backed server. When I post

  • 0

I have a small app using RestKit with a Sinatra-backed server. When I post a user object to the server, the server successfully saves the user and responds with a json representation of the newly created user.

Here’s the code to create a user on the client:

  User *currentUser = [User currentUser];  
  currentUser.email = @"jacob@mail.com";
  currentUser.firstName = @"Jacob";
  currentUser.lastName = @"Morris";
  currentUser.phone = @"2088956709";
  currentUser.deviceId = @"MY-DEVICE-ID";
  currentUser.password = @"password";
  currentUser.passwordConfirmation = @"password";
  currentUser.timeStamp = [NSNumber numberWithFloat:3987987987.12233]; //totally random

  RKSpecResponseLoader *loader = [RKSpecResponseLoader responseLoader];
  [dataController.rkObjectManager postObject:currentUser mapResponseWith:[User rkObjectMapping] delegate:loader];
  [loader waitForResponse];
  NSLog(@"Current user id is now: %@", currentUser.userId);
  STAssertTrue([loader success], @"response from server should be a success");

The response coming back from the server looks like this:

"{\"user\":{\"deviceId\":\"MY-DEVICE-ID\",\"email\":\"jacob@mail.com\",\"userId\":5,\"lastName\":\"Morris\",\"phone\":\"\",\"timeStamp\":3987987968.0}}"

The server is responsible for assigning the userId upon successful creation of the object.
When the response comes back, I’d like the currentUser object be updated on the client side. I’m thinking it should be possible since I’m passing a reference to the posted object to the object loader. How can I get the object loader to update the userId upon a successful response? (I’d like to be able to do this without having to capture the response itself.)

  • 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-28T00:08:40+00:00Added an answer on May 28, 2026 at 12:08 am

    What makes you think the new User object isn’t being updated once the postObject is successful?

    My understanding if when you postObject, in the RKObjectLoader it will try to map the response back to the original object being POST’d as default behavior. The only way to get it to not do it is if you bill out the target object.

    Try something like this:

    [[RKObjectManager sharedManager] postObject: currentUser delegate:self block:^(RKObjectLoader* loader) { 
                loader.resourcePath = @"/users";
                loader.objectMapping = [[RKObjectManager     sharedManager].mappingProvider objectMappingForKeyPath:@"/users"]; 
    }];
    

    As long as you have the mappings setup correctly (coming from the server into the objc-model and the from objc-model to server) and you have your KeyPath setup correctly (is the json { user : { user stuff} } or just { user stuff } ) then it should “just work”.

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

Sidebar

Related Questions

I have small TcpClient app to connect to a server using SSL (SSlStream class)
Using .NET 4.0, I have a small ASP.NET app that utilized the ReportViewer object,
I have a relatively small app that Im building using vb.net 2.0, and nant.
I'm using BerkeleyDB to develop a small app. And I have a question about
I have a small app/site on a dev server with a data table in
I have a small app that downloads some files from a remote (HTTP) server
I have a small app, where user can make some calculations and solve equations.
I have a small app I've written, and it works well when using the
I have a small app that allows the user to draw on the screen
I have a small MVC 3 app using Entity Framework Code First and use

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.