On Wed, Apr 16, 2008 at 4:49 PM, Hamish Allan <hamish...> wrote:
> [myArrayController addObserver:self forKeyPath:@"arrangedObjects"
> options:(NSKeyValueObservingOptionOld|NSKeyValueObservingOptionNew)
> context:nil];
> myDictionary = [[NSMutableDictionary alloc] init];
> [myDictionary bind:@"boundArrangedObjects" toObject:myArrayController
> withKeyPath:@"arrangedObjects" options:nil];
> [myDictionary addObserver:self forKeyPath:@"boundArrangedObjects"
> options:(NSKeyValueObservingOptionOld|NSKeyValueObservingOptionNew)
> context:nil];
> [...]
> KVO is not informing me of the change through the binding.
For anyone reading the archives, I have done some more digging and
found out what the problem is. It appears that NSArrayController does
not send proper KVO notifications for arrangedObjects -- whatever the
change, it reports the old and new values to be nil, which causes the
default implementation of bind:toObject:withKeyPath:options: to drop
the notification rather than forward it (as the old and new values are
equal). I would encourage anyone who uses NSArrayController to file a
bug (mine is rdar://problem/5870167).
Best wishes,
Hamish