• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
mergeChangesFromContextDidSaveNotification effects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mergeChangesFromContextDidSaveNotification effects


  • Subject: mergeChangesFromContextDidSaveNotification effects
  • From: Nathan Vander Wilt <email@hidden>
  • Date: Fri, 16 Jan 2009 14:02:53 -0800

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 (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: mergeChangesFromContextDidSaveNotification effects
      • From: Nathan Vander Wilt <email@hidden>
  • Prev by Date: how to archive NSNetService?
  • Next by Date: Re: modifier-flags with no key pressed and mouseDown 256, why?
  • Previous by thread: Re: how to archive NSNetService?
  • Next by thread: Re: mergeChangesFromContextDidSaveNotification effects
  • Index(es):
    • Date
    • Thread