EOEditingContext is nested in another EOEditingContext

From EOFWiki
Jump to: navigation, search

As EOEditingContexts can be nested in each other, only a save to the root EOEditingContext will then propagate the changes to the database (or other object store).

If you run into this problem, you have probably one layer of EOEditingContexts too many. For getting changes from sibling EOEditingContexts saves, you don't need a shared root context.

In any case, this could be the code you are looking for:

- (void) reallySaveChangesOfEditingContext:(EOEditingContext *) editingContext
{
   Class  ecClass;

   ecClass = [EOEditingContext class];

   while( [editingContext isKindOfClass:ecClass])
   {
      [editingContext saveChanges];
      editingContext = [editingContext parentObjectStore];
   }
}
Personal tools