Search code examples
macoscore-dataicloud

mergeChangesFromContextDidSaveNotification taking up all space


I'm implementing iCloud + Core Data for Mac OS and I'm having a major issue with mergeChangesFromContextDidSaveNotification.

When NSPersistentStoreDidImportUbiquitousContentChangesNotification is posted, I'm calling the following method:

- (void)mergeChangesFromNotification:(NSNotification *)note

{

     self.managedObjectContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy;

     [self.managedObjectContext performBlock:^{

         [self.managedObjectContext mergeChangesFromContextDidSaveNotification:note];

     }];

     // ....

}

The problem is that mergeChangesFromContextDidSaveNotification: does not return and, also, takes up more and more memory until the system runs out space.

Any thoughts on what the problem might be? I'm doing almost the same thing on iOS and works just fine.

Thanks!


Solution

  • I finally found the bug - and as I expected, it was quite stupid one:

    I was merging the changes into the wrong context.