My application imports into an NSManagedObjectContext created on a background thread. As the last stage of this import, I save the background context to the persistent store. All my UI code uses a managed object context on the main thread, and expects to be notified via NSManagedObjectContextObjectsDidChangeNotification to update caches and redisplay.

So... in my background thread I catch the NSManagedObjectContextDidSaveNotification and pass it to a method called on the main thread to - mergeChangesFromContextDidSaveNotification: in the main context. Now I would expect that all the objects I inserted into the background context would get inserted into the main context, and I would see evidence of this in the ObjectsDidChange notification. While the save notification has @"inserted" and @"updated" sets with the expected objects, the change notification only contains the updated object in its @"refreshed" set, and no inserted objects.

Is this what I should expect? Is there a better way I can trigger the ObjectsDidChange notification on my main context after another context updates the persistent store? Or, taking things a step back, what's the best way to keep Core Data fetch request results up-to-date?

thanks,
-natevw
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to