Skip navigation.
 
mlRe: NSArrayController & NSTableView selectionIndexes bug
FROM : William Turner
DATE : Tue Feb 05 23:46:28 2008

Hi Rob,

When you see something receiving valueForUndefinedKey, it's probable 
that the wrong object is receiving the message. In this case, 
"selection" is an NSArrayController key, but it's being sent to an 
NSString. Beyond that, I'm not sure, without seeing some code or 
getting more detail on how things are set up. Somebody else might have 
more ideas.

How are you adding the objects to the array? Via -[NSArrayController 
add] or another method? When you say the array is "in" the custom 
view, do you mean it's an iVar in that object? The array should 
probably be an iVar in your AppController, the array controller's 
contentArray should be bound to it, and the table columns and custom 
view bound to the array controller.

Wil

On Feb 5, 2008, at 1:45 PM, Rob Redpath wrote:

> Hi,
>
> I'm writing an app that has a table containing data on one side of a 
> split view, with its columns bound to an NSArrayController, and an 
> NSView subclass on the other side. It's not a document-based app so 
> I have an AppController class instantiated in IB with two outlets - 
> one for the the NSView subclass, the other for the arrayController. 
> I can add and delete rows from the table just fine, and display the 
> info from the current selection in the custom view, all ok.
>
> The problem I'm having is that whenever I create two or more rows in 
> the table and switch between them the following appears in the debug 
> console:
>
> 2008-02-05 21:20:29.770 GanttXv4[22988:10b] Error setting value for 
> key path selectionIndexes of object <NSArrayController: 
> 0x134dd0>[object class: NSMutableDictionary, number of selected 
> objects: 1] (from bound object <NSTableView: 0x129a30> with object 
> ID 432 in Nib named MainMenu.nib): [<NSCFString 0x191950> 
> valueForUndefinedKey:]: this class is not key value coding-compliant 
> for the key selection.
>
> At first I thought this was related to the fact that I've bound 
> arrayController.arrangedObjects to an NSMutableArray in the custom 
> view, as I want it to display the data for the whole table, not just 
> the current selection, but I've rolled my code back to before that 
> happened and it persists. It doesn't seem to affect the program's 
> execution but I don't want to run into problems later.
>
> So my questions are:
> - Any idea what causes that problem?
> - Am I going about the overall problem the right way?
>
> Thanks
>
> Rob
> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> 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/<email_removed>
>
> This email sent to <email_removed>

Related mailsAuthorDate
mlNSArrayController & NSTableView selectionIndexes bug Rob Redpath Feb 5, 22:45
mlRe: NSArrayController & NSTableView selectionIndexes bug William Turner Feb 5, 23:46
mlRe: NSArrayController & NSTableView selectionIndexes bug Benjamin Stiglitz Feb 6, 19:18