I have an NSFetchedResultsController set up to populate a UITableView, based off my 'main' NSManagedObjectContext.
In a timer, I continually add objects into a separate NSManagedObjectContext, but one that shares its NSPersistantStoreCoordinator with the main context.
I can see NSManagedObjectContextWillSaveNotification notifications being sent, and when I quit an restart the app, I have all the data from the previous run. However, no updates happen to the current NSFetchedResultsController.
I've created a test project and placed it here.
(I initially thought this was happening due to there being multiple threads at play; however, it happens when everything is done in one thread).
Original Question
I have an NSFetchedResultsController set up to populate a UITableView, based off my 'main' NSManagedObjetContext.
In a background thread, I download and import several objects into a separate NSManagedObjectContext, but one that shares its NSPersistantStoreCoordinator with the main thread's context.
I am registered to receive NSManagedObjectContextWillSaveNotification notifications. When I get these, I forward them on to the main thread, and pass them to my main context.
Using the debugger, I can watch these come in, and verify that they are, indeed, adding objects to the context. However, my NSFetchedResultsController is not updating. If I do this all in the main thread, it does work. Calling -performFetch: on the controller will cause it to update, so I know it's not that it's not seeing the new objects.
Most of this is boilerplate code, just split into different threads.