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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:40:53+00:00 2026-06-06T23:40:53+00:00

I create a managed object save the context and post like so: [[RKObjectManager sharedManager]

  • 0

I create a managed object save the context and post like so:

 [[RKObjectManager sharedManager] postObject:tag mapResponseWith:tagMappingForPOST delegate:tagLoader];

The tagLoader gets the object back but fails to save in the RestKit’s context saying:

Failed to save managed object context after mapping completed: The operation couldn’t be completed. (Cocoa error 134030.)

NSUnderlyingException=Cannot update object that was never inserted.

I’m doing the same thing with the same backend server (Parse.com) with the same class and it’s working fine. Any clues as to the potential reasons why one would get a “Cannot update object that was never inserted.” error?

  • 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-06T23:40:54+00:00Added an answer on June 6, 2026 at 11:40 pm

    So it turns out that RestKit expects the context to be saved before sending the postObject:mapResponseWith:delegate message to RKObjectManager. My issue was that I was saving the context right after the postObject:mapResponseWith:delegate message (which I thought was ok because this would still be before the loader ever got a response back from the webservice. I was doing something like so:

    NSManagedObject *myObj = [NSEntityDescription insertNewObjectForEntityForName:@"MyObjects" inManagedObjectContext:context];
    [[RKObjectManager sharedManager] postObject:myObj mapResponseWith:objMappingForPOST delegate:myObjLoader];
    [context save:&error];
    

    … then the myObjLoader would get a response back and attempt to update properties in myObj (createdAt, parse’s objectId, etc.) and throw an error saying that myObj doesn’t exist.

    I should really read through the RestKit code to confirm, but I’m pretty sure what’s happening is that RKObjectManager is creating the background thread and the context from the managed object store at the point in time the postObject:mapResponseWith:delegate message is received and never updates with any potential merges that might exists before the response comes back. To be honest, I expected the context to be created once the response was received.

    So the thing to do is to save the context before sending the postObject:mapResponseWith:delegate message, like so:

    NSManagedObject *myObj = [NSEntityDescription insertNewObjectForEntityForName:@"MyObjects" inManagedObjectContext:context];
    [context save:&error];
    [[RKObjectManager sharedManager] postObject:myObj mapResponseWith:objMappingForPOST delegate:myObjLoader];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need this roadmap of a Hibernate managed object instance. First, I create an
I want to dynamically create object of HtmlDivElement in my jsf managed bean and
My application uses multiple threads with one managed object context per thread. For clarity
I have a main managed object context (MOC) in the UI thread which is
I am using two managed object contexts in my iOS app. The first context
I managed to create a .deb file from a source program,tar.gz how can i
I have managed to create a custom action in C# using MakeSfxCA which is
I already managed to create function which checks if user is using a trial/demo
I have managed to create a simple app which deletes (bypassing the recycle bin)
I've come across an issue where a web application has managed to create a

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.