Re: KVC error from bound SortDescriptor
Re: KVC error from bound SortDescriptor
- Subject: Re: KVC error from bound SortDescriptor
- From: Keary Suska <email@hidden>
- Date: Wed, 14 Jan 2009 15:18:05 -0700
On Jan 14, 2009, at 11:10 AM, Quincey Morris wrote:
On Jan 14, 2009, at 08:35, Keary Suska wrote:
On Jan 14, 2009, at 4:54 AM, Steven Hamilton wrote:
I have a customer WindowController class and within it I have a
method that returns a NSSortDescriptor. Like this;
-(NSArray *)nameSortDescriptors
{
NSSortDescriptor *sorter;
sorter = [[[NSSortDescriptor alloc]
initWithKey: @"name"
ascending: YES] autorelease];
return ([NSArray arrayWithObject: sorter]);
}
...
Error setting value for key path nameSortDescriptors of object
<MLAccountController: 0x58ae390> (from bound object
<NSArrayController: 0x589d1a0>[entity: Account, number of selected
objects: 1](null)): [<MLAccountController 0x58ae390>
setValue:forUndefinedKey:]: this class is not key value coding-
compliant for the key nameSortDescriptors.
... 2) make nameSortDescriptors key value coding compliant.
Jumping in with a quibble ...
The OP's window controller class *is* KVC-compliant for the
'nameSortDescriptors' property, but it's an immutable property. The
sortable column needs it to be a mutable property. The error message
is slightly at fault here.
So the solution is to put the array of sort descriptors in an
instance variable and write a setter for the property, which is, I
think, what you were implying the OP should do.
I stand corrected. To be more specific, I would say a setter or
indexed accessors.
Best,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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