• 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
Re: core data, synchonizing multiple MOC's
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: core data, synchonizing multiple MOC's


  • Subject: Re: core data, synchonizing multiple MOC's
  • From: Diederik Hoogenboom <email@hidden>
  • Date: Sun, 21 May 2006 14:23:26 +0200

I was able to solve it by calling -[anArrayController fetchWithRequest:nil merge:NO error:&error]; at the end of the NSManagedObjectContextDidSaveNotification notification handling. Thanks Jim and Alastair.


Diederik


On 21-mei-2006, at 10:47, Diederik Hoogenboom wrote:

Jim,

I am now catching the NSManagedObjectContextDidSaveNotification notification and do the fresh from there. I have replaced - objectWithID: by -refreshObject:mergeChanges
and to I have also added the following at the end of the notification:


	[context processPendingChanges];
	[anArrayController fetch:self];

Unfortunately, this seems to make no difference. The tableview is not refreshed with the added objects.

Diederik





On 20-mei-2006, at 14:06, Jim Correia wrote:

On May 20, 2006, at 4:24 AM, Diederik Hoogenboom wrote:

I have a separate managed object context (threaded) in which I insert a managed object. When the thread completes I save the changes and try to make the main MOC aware of the new objects. However the changes are not visible in the tableview bound to the array controller (bound to the main MOC) . When I do the inserting using the main MOC everything works fine.

The method I use to make the main MOC aware of the second MOC is objectWithID using the result of objectID from the second MOC. Instead of objectWithID: I have also tried refreshObject: mergeChanges: with no result.

-objectWithID: doesn't make the MOC aware of the object. It causes the MOC to fetch the object or return a fault.


-refreshObject:mergeChanges is the right way to merge in the changes from another MOC, and for objects already in the UI, KVO will cause the objects to update via bindings.

If new objects appear, you need to arrange for your controllers to refetch.

Jim

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >core data, synchonizing multiple MOC's (From: Diederik Hoogenboom <email@hidden>)
 >Re: core data, synchonizing multiple MOC's (From: Jim Correia <email@hidden>)
 >Re: core data, synchonizing multiple MOC's (From: Diederik Hoogenboom <email@hidden>)

  • Prev by Date: Re: bindings + actions
  • Next by Date: Re: Determining how the app is run (intel/ppc/rosetta/os version)?
  • Previous by thread: Re: core data, synchonizing multiple MOC's
  • Next by thread: Problems centering window
  • Index(es):
    • Date
    • Thread