• 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
NSManagedObjectContextObjectsDidChangeNotification confusion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSManagedObjectContextObjectsDidChangeNotification confusion


  • Subject: NSManagedObjectContextObjectsDidChangeNotification confusion
  • From: Roland King <email@hidden>
  • Date: Tue, 11 Jun 2013 21:47:14 +0800

My first time really trying to do multi-threaded Core Data ..

I have two contexts, A and B. Things are changing in A, I want to track them in B. I think I understand how the ..DidSaveNotification works with mergeChangesFromContextDidSaveNotification:, it can refresh the objects in B's context and they will be reloaded from the store they were just saved in and thus updated to match A.

I'm not sure how to use NSManagedObjectContextObjectsDidChangeNotification however, to get changes more often. When I receive one of those it has the same keys as the DidSaveNotification, however the objects haven't yet, and may not for a while, be saved in the persistent store, they are just sitting in A, so just refreshing the objects in B won't really help, they'll just be reloaded from the saved database and you'll get the old values again, not those as they are in context A.

The only way I can think this would work is if B is a child context of A, in which case the refresh would cause the updated objects to be pulled back from that, updated, context. However the DidChangeNotification completely predates child contexts by 3 iOS revisions so I must be missing something. The documentation suggests that in context B you can reload the affected objects, but I don't really see how, they aren't saved.
_______________________________________________

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: NSManagedObjectContextObjectsDidChangeNotification confusion
      • From: Jerry Krinock <email@hidden>
  • Prev by Date: Re: CALayer -displayLayer:inContext: never called during frame/bounds animation
  • Next by Date: Re: NSManagedObjectContextObjectsDidChangeNotification confusion
  • Previous by thread: Re: Staying on integrated GPU while using NSOpenGLView
  • Next by thread: Re: NSManagedObjectContextObjectsDidChangeNotification confusion
  • Index(es):
    • Date
    • Thread