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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:59:49+00:00 2026-06-04T19:59:49+00:00

I have this code: Store* store = [NSEntityDescription insertNewObjectForEntityForName:@Store]; store.name = @My Company …

  • 0

I have this code:

Store* store = [NSEntityDescription insertNewObjectForEntityForName:@"Store"];
store.name = @"My Company"
...

Now the store is managed in the context and will be saved when the context is saved, but I have a button where the user can cancel the form where data is collected. How do I undo or remove this from the context? Or am I thinking wrong?

  • 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-04T19:59:51+00:00Added an answer on June 4, 2026 at 7:59 pm

    As mentioned earlier, you can use an undo manager. Or, you could simply use a separate ManagedObjectContext, and do all your changes in there. If you decide to keep them, save the context. If not, simply discard it. A MOC is just a scratch pad for work, and has no impact on the underlying database until saved.

    You can’t really “detach an entity” but you can cause a managed object to turn back into a fault, losing any changes that have not been saved.

    [managedObjectContext refreshObject:object mergeChanges:NO];
    

    Snipped from the documentation…

    If flag is NO, then object is turned into a fault and any pending
    changes are lost. The object remains a fault until it is accessed
    again, at which time its property values will be reloaded from the
    store or last cached state.

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

Sidebar

Related Questions

Im create this code to store page view in database, but i have problem
I have used this code to store Object to a file: try{ FileOutputStream saveFile=new
This is a simplified code. I have a webservice (.asmx) as following: I store
I have this code: std::string name = kingfisher; char node_name[name.size()+1]; strcpy(node_name,name.c_str()); node_name[name.size()] = '\0';
I have this code here: <?php while($rowequipment = mysql_fetch_assoc($sqlequipment)) { echo '<input type=checkbox name=equipment[]
I have this code: var comboStore = new Ext.data.Store({ proxy : new Ext.data.HttpProxy({ url
This code in a store procedure worked for years, now on the OPEN line
I have this code: I want to store some vales in a day of
I have this code, it is successfully storing the 'author_id' but I want it
I have this code right now : $(document).ready(function() { var ktitle = $('.hiddentwo').text(); $('div#tab2').load('morefour.php?title=ktitle');

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.