• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Bindings Faked Array Item Problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Bindings Faked Array Item Problem
      • From: Thilo Ettelt <email@hidden>
References: 
 >Bindings Faked Array Item Problem (From: Thilo Ettelt <email@hidden>)

  • Prev by Date: Re: RAW image format support in NSImage
  • Next by Date: Re: playing swf file
  • Previous by thread: Bindings Faked Array Item Problem
  • Next by thread: Re: Bindings Faked Array Item Problem
  • Index(es):
    • Date
    • Thread