How can I duplicate the execution of NSFetchedResultsController while monitoring Core Data?

I have a model that does some work with master data, and I'm currently using NSFetchedResultsController to get notified when something changes in the master data. I do not control the UITableView, and the API for the resulting result controller is a bit inconvenient. I want to replace it with something simpler. My question is, how does NSFetchedResultsController listen for changes in Core Data and how can I duplicate it for a more convenient API? I am using iOS 5+

+3
source share
1 answer

It looks like you can receive notifications from your MOC as follows:

Core Data uses these string constants as keys in the user info dictionary in aNSManagedObjectContextObjectsDidChangeNotification notification.

NSString * const NSInsertedObjectsKey;
NSString * const NSUpdatedObjectsKey;
NSString * const NSDeletedObjectsKey;
NSString * const NSRefreshedObjectsKey;
NSString * const NSInvalidatedObjectsKey;
NSString * const NSInvalidatedAllObjectsKey;

As an approach, perhaps you can start by compiling the complete protocol that you desired for us, and then add the implementations and small tests that you need to it.

+3
source

All Articles