On Nov 11, 2008, at 8:08 PM, Andre Masse wrote:

I'm having trouble converting an object to a BOOL. In my window controller, I'm observing the model keyPath isDirty which is a BOOL.

version 1
----------------
- (void) observeValueForKeyPath:(NSString *)keyPath
                                           ofObject:(id)object
                                                 change:(NSDictionary *)change
                                                context:(void *)context 
{
        if(object == model) {
                if([keyPath isEqualToString:@"isDirty"]) {
[self setDocumentEdited:[change objectForKey:NSKeyValueChangeNewKey]];
                        
                }
        }
        
}

I know this isn't the question you asked, nor the root of the problem you are having, but by way of saving you future pain, that is not the correct way to write an - observeValueForKeyPath:ofObject:change:context: method.

Always use a unique context. Use the context to determine if the message is for your (not object or keyPath comparisons.) Call super for all contexts that you do not recognize as yours.

Additional details available in the list archives.

Jim

_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to