Note that there are some explanatory texts on larger screens.

plurals
  1. PONSFetchedResultsController not showing updates from other contexts
    primarykey
    data
    text
    <p>I have an NSFetchedResultsController set up to populate a UITableView, based off my 'main' NSManagedObjectContext.</p> <p>In a timer, I continually add objects into a separate NSManagedObjectContext, but one that shares its NSPersistantStoreCoordinator with the main context.</p> <p>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.</p> <p>I've created a test project and placed it <strong><a href="http://dl.dropbox.com/u/85235/MultiContext%20Core%20Data.zip" rel="nofollow noreferrer">here</a>.</strong></p> <p><br/><br/> <em>(I initially thought this was happening due to there being multiple threads at play; however, it happens when everything is done in one thread).</em></p> <p><strong>Original Question</strong></p> <p>I have an NSFetchedResultsController set up to populate a UITableView, based off my 'main' NSManagedObjetContext.</p> <p>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.</p> <p>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.</p> <p>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.</p> <p>Most of this is boilerplate code, just split into different threads.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload