Re: Core Data: updating a key dependent on a to-many relationship?
Re: Core Data: updating a key dependent on a to-many relationship?
- Subject: Re: Core Data: updating a key dependent on a to-many relationship?
- From: mmalcolm crawford <email@hidden>
- Date: Mon, 30 Jan 2006 01:24:19 -0800
On Jan 29, 2006, at 11:14 AM, Nathan Tyler wrote:
I am developing a Core Data application that has an entity with a
to-many relationship with another entity. I need to notify the
parent/single object when its corresponding "many" entities are
edited/added/removed in order to update a total, average, etc. In
this case the triggerChangeNotificationsForDependentKey will not work.
I have found a corresponding section in Apple's Core Data FAQ:
http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/
Articles/cdFAQ.html#//apple_ref/doc/uid/TP40001802-
DontLinkElementID_13
This seems to be the exact example of what I need. However, as it
is one of my first endeavors in this area, I need some basic help on:
"You must add and remove the parent as an observer as child objects
are added to and removed from the relationship."
I'm not sure how to do this.
See <http://developer.apple.com/documentation/Cocoa/Conceptual/
KeyValueObserving/Concepts/KVOBasics.html#//apple_ref/doc/uid/
20002252> for a discussion of registering as an observer using KVO.
See <http://homepage.mac.com/mmalc/CocoaExamples/controllers.html>
[Graphics Bindings] for an example of observing an array using KVO
and responding to changes.
mmalc
_______________________________________________
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