Re: Bindings Faked Array Item Problem
Re: Bindings Faked Array Item Problem
- Subject: Re: Bindings Faked Array Item Problem
- From: Felix Franz <email@hidden>
- Date: Fri, 17 Mar 2006 15:18:08 +0100
On Mar 17, 2006, at 2:38 PM, Thilo Ettelt wrote:
Hello,
I'm using bindings (NSTreeController) for feeding an Outline view
with data, I have used the appropriate accessor methods and they
are called ( -(MyObject *)objectInMyArrayAtIndex:.... etc). But
after an object is inserted and then after -objectInMyArrayAt... is
called I get an error:
"unexpected state: trying to insert object
<NSKVONotifying_MyObject: 0x3b8650> failed. Destination node == nil
or destination node did not retain the object"
Sounds like the NSTreeController gets no notification that your
"MyArray"-collection is modified.
You could either implement the indexed-accessor-methods
(insertObject:in<Key>AtIndex:, replaceObjectIn<Key>AtIndex:, and
removeObjectFrom<Key>AtIndex:) and use the mutableArrayValueForKey:
to change the array (Automatic Observer Notification). Or use manual
Observer notification and call
the proper willChange:valuesAtIndexes:forKey:/
didChange:valuesAtIndexes:forKey:-
methods when changing your collection. See (file:///Developer/ADC%
20Reference Library/documentation/Cocoa/Conceptual/
KeyValueObserving/Concepts/AutoVsManual.html).
I once had a similar problem which disappeared after implementing the
indexed-accessor-methods
and using mutableArrayValueForKey: to change the array.
Hope this helps,
felix
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden