> On Mar 19, 2009, at 11:18, m...@sky4studios.be wrote:
>
>>> 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?
>>
>> Did you look at the code? The sample code is right there it will
>> tell you
>> what class it is.
>
> Er, sorry, operator error. I didn't scroll down past your signature
> and the blank lines that followed it.
>
>>> 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.
>>
>> There is nothing in the log file except for the exception. that is
>> being
>> called when you call removeObserver... I guess you didn't run the
>> code..
>
> So what *is* the exception? (No, I'm not planning on running your
> code. What's important is the error message *you* got.)

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.'

Also in the debugger setting a breakpoint before the removeObserver

po [myTestArrayController observationInfo]

You will get:

<NSKeyValueObservationInfo 0x10c380> (
<NSKeyValueObservance 0x10da70: Observer: 0x10ac00, Key path:
targetPhoto.name, Options: <New: YES, Old: NO, Prior: NO> Context: 0x21,
Property: 0x10bce0>
)

and doing a further investigation on the observation info:

po 0x10bce0


<NSKeyValueNestedProperty: Container class: NSMyArrayController,
Relationship property: <NSKeyValueUnnestedProperty: Container class:
NSMyArrayController, Key: targetPhoto, isa for autonotifying:
NSKVONotifying_NSMyArrayController, Key paths of directly and indirectly
affecting properties: none>, Key path from related object: name>

Also the sample code I posted will work fine, in case you replace the
NSArrayController with NSObject.

But it will fail in case it is NSController, NSObjectController.

cheers,

marc

















_______________________________________________

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