Problem with contexts synchronization and related arrayControllers when deleting objects in one of the contexts (again)
Problem with contexts synchronization and related arrayControllers when deleting objects in one of the contexts (again)
- Subject: Problem with contexts synchronization and related arrayControllers when deleting objects in one of the contexts (again)
- From: "Gustavo Vera" <email@hidden>
- Date: Tue, 30 Jan 2007 18:03:38 -0300
Hello. I have the exact same problem that the one described in the next
post: http://lists.apple.com/archives/cocoa-dev/2006/Mar/msg00132.html
I describe here the problem again:
I have two MOC connected to the same persistent store coordinator. Both
context are, initially, without any changes ([moc hasChanges] returns false
for both).
Then, I delete one object using an "almost automatically" generated UI (I
have to re-establish the connections of the automatically instantiated array
controllers in the nib to one of my contexts).
After the deletion, I save the changes in that context.
At the same time, I have another UI loaded and showing the same entities (In
a combo). This second UI uses the second MOC, in which I still have the
previously deleted object at the other context.
I tried some aproaches using the notifications posted with the notification
center during the deletion and/or during the save operation in the first
context. I was capturing this notifications and posting similar ones from
the second context, but that was unsuccessful. A simple deletion of a
recovered registered object in the second context (recovering by objectID)
doesn't work also (even raises a fault sometimes, I think). Resetting the
second context isn't a good option too, because even if I previously collect
the objects IDs of the registered objects and do a reload, the corresponding
array controllers become "clean" (And the related UIs shows nothing after
that).
The responses in the post of the link above doesn't give any solution to the
problem of refreshing the array controller contents linked to the second
MOC. I think that the last answer is very similar (if not a copy-paste) of
the official documentation about this matter in
http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdChangeManagement.html#//apple_ref/doc/uid/TP30001201
(check the section 'Communicating Changes Between Contexts').
I think I'm in the 'best case scenario' but I can't solve this problem. Any
idea?
The insertion and update is working just fine using notifications, the array
controllers became aware of the changes just fine if I do a
refreshObject:mergeChanges: or a objectWithID: fetch. The problems seems to
be only with the deletion workflow.
Is there something I'm missing?
Thanks in advance!
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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