If you are targeting Leopard or later, Apple has simplified the setup.
In the stream of your manufacturer, create MOCs with the same PSC as the MOCs in your main stream. You can pull objects from your web service in this thread, create new objects and save them as usual.
In your consumer chain, add a controller as an observer for NSManagedObjectContextDidSaveNotification. Your callback should look something like this:
- (void) managedObjectContextDidSave:(NSNotification *)notification { NSManagedObjectContext *managedObjectContext = [notification object]; if(managedObjectContext != self.managedObjectContext) [self.managedObjectContext mergeChangesFromContextDidSaveNotification:notification]; }
Thus, objects stored in the producerโs stream will automatically be drawn into your consumer stream.
sbooth
source share