I’m new with Core Data and I have some questions about how to do the things in the right way. I think I need a temporaryManagedObjectContext to work with temporary entities, while user is editing a new entity. When user tap save that data I want to insert those entities in the persistedManagecObjectContext and then saveContext. What is the best practice to achieve this? Since I don’t want to save in the temp context, it is mandatory to use threading?
Thanks for your knowledge!
You need to merge the changes in the temporary ManagedObjectContext (MOC) into the persisted one. This is an example of how I achieved this.
Im using threading (One MOC per thread), but Im pretty sure it should work out fine without threads aswell.
You call this method to save your changes in the tempMOC:
…which will fire off a notification to:
…which in turn calls: