Re: Core Data: Custom to-many relationship setter not being invoked
Re: Core Data: Custom to-many relationship setter not being invoked
- Subject: Re: Core Data: Custom to-many relationship setter not being invoked
- From: Ken Tabb <email@hidden>
- Date: Tue, 23 Feb 2010 22:20:30 +0000
On 23 Feb 2010, at 9:17, mmalc Crawford wrote:
> <http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Core
> Data/Articles/cdTroubleshooting.html#//apple_ref/doc/uid/TP40002320-SW3>
>
> Custom relationship set mutator methods are not invoked by an array controller
> Problem: You have implemented set mutator methods for a relationship as described
> in "Custom To-Many Relationship Accessor Methods", and have bound
> the contentSet binding of an NSArrayController instance to a relationship
> (as illustrated by the Employees array controller in NSPersistentDocument
> Core Data Tutorial), but the set mutator methods are not invoked when you add
> objects to and remove objects from the array controller.
>
> Cause: This is a bug.
>
> Remedy: You can work around this by adding self to the contentSet binding's
> key path. For example, instead of binding to [Department Object Controller
> ].selection.employees, you would bind to [Department Object Controller].sel=
> ection.self.employees.
>
> mmalc
Sob.
I only wish that, when I'd read this very section several times, I hadn't thought "no that's not the problem I'm seeing, reckon I've got a live one" :-/
I've just put an update on bug 7677425, so that they know to mark it as a duplicate etc.
As it happens, it turns out I didn't need custom accessors anyway and can do everything I need via KVO, but I couldn't see what I was doing wrong, so presumed I was misunderstanding it (a common cause, you'll be surprised to hear).
Thanks folks,
Ken
Tail between his legs again...
. . . . . . . . . . . . . . . . . . . . . . . . . . .
Dr. Ken Tabb
Mac & UNIX programmer
Neural network & computer vision researcher
University of Hertfordshire, UK
_______________________________________________
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