On Mar 19, 2009, at 09:53, m...@sky4studios.be wrote:

Bug in short Terms: KVO or Bindings with a custom key like "targetPhoto"
here in my example doesn't work properly when that keyPath contains an
extra element like "targetPhoto.name" and when the object is an
NSController or (subclass because I notice this bug with
NSArrayController).

You will also see an exception when you removeObserver for that key after
you first set the key.

This sequence basically causes an exception on the removeObserver call.

 [myArraController addObserver: ... keyPath  "targetPhoto.name"  ...];
 [myArraController setTargetPhoto:...]; // this Triggers the KVO
notification
 [myArraController removeObserver: ... keyPath  "targetPhoto.name"];

This was my initial bug that I was tracing

 [myArraController addObserver: ... keyPath  "targetPhoto.name"  ...];
 [myArraController setTargetPhoto:...]; // this Triggers the KVO
notification
[[myArraController targetPhoto:] setName:@"the new name"]; // this DOES
NOT Trigger the KVO notification
 [myArraController removeObserver: ... keyPath  "targetPhoto.name"];

By the way this above code works fine in case the key is "arrangedObjects"
and do something like this:

[myArraController addObserver: ... keyPath "arrangedObjects.name" ...];
 [myArraController setTargetPhoto:...]; // this Triggers the KVO
notification
 [[myArraController targetPhoto:] setName:@"the new name"]; / this
Triggers the KVO notification
[myArraController removeObserver: ... keyPath "arrangedObjects.name"];

Based on what you've posted, your source code looks rather messed up. Presumably you have a NSArrayController subclass with a "targetPhoto" property. What kind of property? Is it an array object?

The first thing you need to do is to find all the error messages in your run log (and I suspect there are multiple errors, even before the exception) and post the actual message text. You almost certainly did *not* find a bug.


_______________________________________________

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

Reply via email to