Sunday, October 4, 2009

Bindings: multiple controllers (4)

A quick note about the bug in the first example of PopUp bindings to a selection in a table view. I was not able to figure out what is going wrong. The console log says:

2009-10-04 17:38:36.856 PopupBindings[9038:a0f] 
[<NSCFString 0x1000030c8>valueForUndefinedKey:]: this class
is not key value coding-compliant for the key weapons.


It looks like we're trying to send a set or get message to a string. I'm not good enough with gdb to follow into the stuff that happens when bindings are being established. The string in question is not at the same address as any of my variables, including all the strings.

The weird thing is that I modified the second version to look exactly the same as the first, and it works. I looked hard for differences in the bindings, key listing...nothing.

The second version is not special. (I used selectedItems and items as keys, not thinking hard about it, but if I change those it still works fine).

Even weirder, on one trial when modifying, doing a simple key substitution (selectedWeapon for selectedItem) I got the SIGABRT behavior. But, I could not revert it by switching back, nor could I get it to repeat! I remain mystified.