I'm using KVO to get notification of changes to NSArrayController's selectionIndex
[contoller addObserver:self forKeyPath:@"selectionIndex" options:NSKeyValueObservingOptionNew context:NULL];
and when I set the selection using setSelectedObjects: I get notified of selectionIndex changing as I expect. However when I try to get NSKeyValueChangeNewKey from the change dictionary it always returns NULL.
Printing the dictionary shows:
{ kind = 1; new = ""; }
Is this because the selectionIndex value is a NSUInteger and can't be put in a dictionary or am I doing something wrong?
It's not such a problem for me as I can get the selectionIndex from the controller through other means when I get this notification, I'd just like to know why its not doing what I expected.
I'm seeing this behaviour on a 10.6 app build with Xcode 4.2.1 on Lion 10.7.3.
The notification fires, but the change dictionary is always NULL.
As you say, once you have the notification firing you can get selectionIndex manually, so not an issue for my app.
I Googled around a bit and found that this was a known bug back about 3 years ago or so, so perhaps it still is?
http://www.cocoabuilder.com/archive/cocoa/231886-problem-observing-selectionindex-of-an-array-controller.html