• 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
KVO / Core Data question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

KVO / Core Data question


  • Subject: KVO / Core Data question
  • From: "Paul L. Gribble" <email@hidden>
  • Date: Wed, 14 Dec 2005 11:49:27 -0500
  • Thread-topic: KVO / Core Data question

I have an entity "Trip" that has a to-many relationship to another entity,
"Transaction" via a relationship called "transaction".

The Trip entity has a key called "balance" whose value I want to depend on
the sum of all of the "amount" keys of each transaction.

I understand from reading Apple's Core Data FAQ (pg. 108-109) that it's not
possible to do this using setKeys:triggerChangeNotificationsForDependentKey,
where the key would be a key-path (e.g. email@hiddent).

The FAQ suggests two solutions - one, use KVO to register the parent as an
observer of the relevant attribute of all the children; and one must then
add and remove the parent as an observer, each time child objects are added
to or removed from the relationship. This seems not very efficient compared
to the second suggestion:

register the parent with the application's notification center as an
observer of its managed object context. This seems like less coding to me,
but there are no examples. Can anyone provide, or point me to, a code
snippet showing how one would do this?

Thanks,


_______________________________________________
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

  • Follow-Ups:
    • Re: KVO / Core Data question
      • From: Diederik Hoogenboom <email@hidden>
    • Re: KVO / Core Data question
      • From: Phil Frost <email@hidden>
  • Prev by Date: Re: WWDC 2005 DVDs [OT]
  • Next by Date: Re: NSXMLParser useless with HUGE files
  • Previous by thread: Re: NSXMLParser useless with HUGE files
  • Next by thread: Re: KVO / Core Data question
  • Index(es):
    • Date
    • Thread