Re: Bindings Faked Array Item Problem
Re: Bindings Faked Array Item Problem
- Subject: Re: Bindings Faked Array Item Problem
- From: Thilo Ettelt <email@hidden>
- Date: Mon, 20 Mar 2006 15:53:36 +0100
I've posted an example on my webserver. Maybe someone can help me then.
The URL is: <http://www.itoast.de/bindings array test.zip>
Thx in advance,
Thilo
Am 17.03.2006 um 15:18 schrieb Felix Franz:
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