Re: Binding problem with core data
Re: Binding problem with core data
- Subject: Re: Binding problem with core data
- From: Velocityboy <email@hidden>
- Date: Sat, 02 Feb 2013 17:25:10 -0800
Finally got a chance to do some more debugging on this.
I looked at the referenced object and figured out why the fault, at least. I had tried to bind the subcategory column's Content to category.subcategories, which resolved to a relationship on an NSManagedObject. Under the covers, evidently a relationship is represented as a set, but per the docs, the Content binding has to be to an array (the docs actually say it should be an NSArrayController.)
So evidently directly binding Content and Content Values to something hanging off a managed object, without going through a controller, is not a great idea.
What I don't see is how to express what I want using an array controller, if that's what I have to do. I see two choices:
- Bind the array controller for the popup's elements, somehow, to the 'subcategories' relationship for the category object that's selected in each row of the table
- Bind the array controller for the popup's elements to the core data entity that represents all of the subcategories, and somehow specify to filter that data per row to just the elements that have a parent of the category that's selected in the row
Is it possible to express either of these using just a binding? Or is this case complex enough that I should be looking at doing this part in code?
Thanks!!
On Jan 30, 2013, at 11:23 PM, Quincey Morris wrote:
> On Jan 30, 2013, at 22:41 , Velocityboy <email@hidden> wrote:
>
>> I see two bizarre behaviors: when I change the Category value with the popup button cell in one row, Category values in other rows change. When I change the subcategory, I get an exception:
>>
>> 2013-01-30 22:32:23.192 Testapp[10506:f03] -[_NSFaultingMutableSet objectAtIndex:]: unrecognized selector sent to instance 0x101d5dfd0
>
> A NSArray selector is being sent to a NSSet object. That suggests you've forgotten to set the NSArrayController into "entity" mode, which is necessary for a Core Data property, which is modeled as a set rather than an array.
>
> In "class" mode, the array controller expects its content to be an array; in "entity" mode, it expects the content to be a set.
>
_______________________________________________
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