I have a question with application design in which I hope someone can help.
Let's take a very simple setup: the Basic Data application to display news from the server.
The main thread / user interface has a managed object context that is used by all view controllers to display data.
NSOperation runs in the background, checking the server with its own context in the same persistent storage.
I want to merge the changes in the background context, so I use NSManagedObjectContextObjectsDidChangeNotification.
According to Apple docs :
Several system frameworks use Core Data internally. If you register to receive these notifications from all contexts (passing nil as an object parameter to the addObserver method ...), you may receive unexpected notifications that are difficult to handle.
So, I want to filter out my notifications, combined in the main MOC stream, only with those changes that come from the background MOC operation.
What is the cleanest way to get / maintain a link to the MOC background so that I have something that can be connected to the addObserver method and the notifications are properly filtered? I can come up with many ways that involve a lot of grip, but they all seem to be hacked.
Any suggestions or ideas? How do others deal with this?