> On Mar 19, 2009, at 12:03, m...@sky4studios.be wrote: > >> In this narrowed down code of the bug it will log this on >> removeObserver >> (please ignore the Terminating app due to uncaught exception >> 'NSInternalInconsistencyException', reason) because I just created >> simple >> main sample code to narrow it down: >> >> *** Terminating app due to uncaught exception >> 'NSInternalInconsistencyException', reason: 'Cannot remove an observer >> <Observer 0x10ac00> for the key path "targetPhoto.name" from >> <NSMyArrayController 0x1099d0>, most likely because the value for >> the key >> "targetPhoto" has changed without an appropriate KVO notification >> being >> sent. Check the KVO-compliance of the NSMyArrayController class.' > > This is not a lot of help to you, but I vaguely remember a discussion > on this list a couple of months ago about problems with KVO on > subclassed NSArrayControllers. I can't find the thread, but I did find > that someone has been here before you: > > http://www.cocoabuilder.com/archive/message/cocoa/2008/4/15/204196
good catch i didn't find that one, at least i made some simple sample code to point out the bug to Apple Developers, so hopefully they can address it now. > Why it should fail is not clear, but it may be that the code that adds > observers does something special with NSArrayControllers (but doesn't > realize your class is a subclass, or can't work properly if it's a > subclass). > > Alternatively, it may be a side effect of the well-known defect in > NSArrayController where its KVO notifications don't contain the proper > new/old values. > > If I understand your workaround correctly, it bypasses (what we assume > to be) NSArrayController's own overrides of didChange.../ > willChange... . That may get your custom property observer > notifications to work properly, but my guess is that this will break > (some) behavior of any objects using the NSArrayController's usual > notifications. I call [super didChange... for non-custom keys and I'm calling NSObject didChange in case it is my custom key. So hopefully this address that issue... I haven't tested my patch long enough to say it will work 100% in all scenarios but at least in the app I'm working on everything seems to work ok so far... (need a few more days of testing before..). > A better workaround strategy might be to avoid subclassing > NSArrayController, and find another way to achieve what subclassing > was going to get for you. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com