• 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
[UNSOLVED] How to observe every child entity
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[UNSOLVED] How to observe every child entity


  • Subject: [UNSOLVED] How to observe every child entity
  • From: Matthew Lindfield Seager <email@hidden>
  • Date: Thu, 17 Sep 2009 11:25:32 +1000

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 (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: [UNSOLVED] How to observe every child entity
      • From: Jim Correia <email@hidden>
    • Re: [UNSOLVED] How to observe every child entity
      • From: Jerry Krinock <email@hidden>
References: 
 >How to observe every child entity (From: Matthew Lindfield Seager <email@hidden>)
 >Re: How to observe every child entity (From: Kyle Sluder <email@hidden>)
 >Re: How to observe every child entity (From: Matthew Lindfield Seager <email@hidden>)
 >[SOLVED] How to observe every child entity (From: Matthew Lindfield Seager <email@hidden>)

  • Prev by Date: Re: NSInvocation or NSTimer with an arg
  • Next by Date: Re: How to create subentity object inheriting from superentity object in core data
  • Previous by thread: [SOLVED] How to observe every child entity
  • Next by thread: Re: [UNSOLVED] How to observe every child entity
  • Index(es):
    • Date
    • Thread