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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:08:05+00:00 2026-06-01T20:08:05+00:00

Possible Duplicate: Store But Don't Save NSManagedObject to CoreData? I need to make an

  • 0

Possible Duplicate:
Store But Don't Save NSManagedObject to CoreData?

I need to make an NSManagedObject without saving it, how can I do this?

The reason I want to do this is the app has a setup in which the user enters their details, however I only want to save the object if they complete the setup (they have the option to cancel, in which case the object needs to be discarded without being saved, which is why I don’t want to insert it straight away).

I have tried insetting one without a context but the app crashes.

I have tried the following:

GuestInfo *guest;
guest = (GuestInfo *)[NSEntityDescription insertNewObjectForEntityForName:@"GuestInfo" inManagedObjectContext:nil];

This causes the crash with the following error message:

'NSInternalInconsistencyException', reason: '+entityForName: could not locate an NSManagedObjectModel for entity name 'GuestInfo''
  • 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-01T20:08:06+00:00Added an answer on June 1, 2026 at 8:08 pm

    I would recommend creating the managed object and inserting into your managed object context as normal. You will have a reference to the managed object, i.e.:

    GuestInfo* guest = (GuestInfo *)[NSEntityDescription insertNewObjectForEntityForName:@"GuestInfo" inManagedObjectContext:managedObjectContext];
    

    Then if the user cancels, just delete it from the managed object context like this:

    [guest deleteInContext:managedObjectContext];
    

    The managed object context is designed as a scratchpad for you to create and delete objects in it like this.

    Another option you might consider is calling:

    [managedObjectContext rollback]
    

    if the user cancels. i.e. you would create the managed object in the managed object context, but if the user cancels, you undo or rollback the state of the managed object context to how it was at the last time it was saved. See the “Undo Management” section of the Apple’s “Using Managed Objects” doc:

    https://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/CoreData/Articles/cdUsingMOs.html

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

Sidebar

Related Questions

Possible Duplicate: PHP 2-way encryption: I need to store passwords that can be retrieved
Possible duplicate: How can i give app store link in my apps before approving
Possible Duplicate: Modify the URL without reloading the page I just came across this
Possible Duplicate: how to parse json in javascript I need to parse this JSON
Possible Duplicate: Can i save lots of bitmaps to one bitmap? (2d) I wonder
Possible Duplicate: Storing Images in DB - Yea or Nay? I need to store
Possible Duplicate: ActionBarSherlock 4.0 doesn't work. But 3.5.1 do. I'm trying to use ActionBarSherlock
Possible Duplicate: When is it OK to use an XML file to save information?
Possible Duplicate: Is it ever ok to store password in plain text in a
Possible Duplicate: Using ApplicationSettings to store Checked property for WinForms RadioButtons I have three

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.