Someone kindly warned me off-list about taking care when an item is
deleted and then re-added by an Undo. It turns out my "solution" was
not complete (nor correct - see below).

When a user undoes a deletion it calls the primitive accessor which
does not emit KVC/KVO notifications. I get the feeling that the
obvious workaround of manipulating observers in the primitive
accessors is a bad idea and is likely to just open another can of
worms. I also get the feeling that this issue is similar to other
people's previously discussed issues and that I'm going to need to
take over the undo/redo responsibilities from the NSArrayController
(as mentioned in this post:
http://cocoaconvert.net/2009/05/07/core-data-rough-riding/).

Which leaves me with two questions I can't yet answer and would
greatly appreciate some assistance with:
1) Is my gut feeling about not using primitive accessors to manage
observers correct?
2) Is there a simple way to override that small aspect of the
undo/redo system (as I'm lazy and everything else is working well) or
do I need to implement undo/redo myself?



For any one else reading this that is struggling to do something
similar the reason my previous solution was less than correct (on top
of being incomplete) is that I added a declaration of the related
object (Account *account;) to use for the relationship and modified
that directly in the KVC compliant method (- (void)setAccount:(Account
*)newAccount) when I should have been calling the auto generated
primitive methods to do that. See
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreData/Articles/cdAccessorMethods.html
for more info.

I'm beginning to think Aaron Hillegass was wrong (not about some
things being hard, just about me not being stupid! :))
_______________________________________________

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