On Mar 17, 2011, at 11:01, Luke Evans wrote:
> The column for Territories in the master SalesRep table is bound so that
> cell values should be the relationship set.
I'm not sure I can nail the problem down exactly, since your setup is fairly
complex, but I'm pretty sure the above is the cause of the problem. There
*isn't* any such thing as the relationship set, not really.
If you request [salesRep valueForKey: @"Territories"] -- the property really
ought to be a lower-case "territories", BTW -- you'll get a set, but it's just
a set. Nothing promises that the set represents the relationship. It's just a
set of the things in the relationship, and could be a transient object created
only in response to your request for the related territories. Since it's
showing up as a _NSFaultingMutableSet, it's probably some kind of set proxy
whose internal implementation fetches actual objects lazily from the Core Data
store.
Something like this:
[[salesRep valueForKey: @"Territories"] addObject: someObject]
doesn't mutate the relationship. For that, you need to use a mutable set proxy:
[[salesRep mutableSetValueForKey: @"Territories"] addObject: someObject]
That's what array controllers normally to do change relationships, I believe.
In your case, you've defeated this by using your so-called relationship set
directly. In other words, you've just connected your array controller to a
contentSet; you haven't actually bound anything that matters to the
"Territories" property of the salesRep object.
At least, I think that's what's wrong. To fix it, I think you need to do either
of two equivalent things:
a. pass the salesRep object and the name of the property "Territories" through
to the cell, rather than passing the transient set through, and access the
property via KVC, further downstream
b. pass a mutable set proxy for the relationship through to the cell, and
connect the array controller to that
Sorry if that all sounds a bit vague.
_______________________________________________
Cocoa-dev mailing list ([email protected])
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 [email protected]