On Wed, 17 Mar 2010 09:55:01 -0700, Jerry Krinock <[email protected]> said: >... And I supposed it could be argued that nothing was wrong, since constKeyShowStatusMenu is a Boolean property, nil = NO
There is no such thing as a "Boolean property" in the user defaults. The only things that can go into the user defaults are plist-able values, and a Boolean is not one of those. When you want to store YES and NO in the user defaults, you store an NSNumber which is *wrapping* the Boolean value. NSUserDefaults includes convenience methods for converting a Boolean to an NSNumber for you (setBool:forKey:, boolForKey:) but the value in the defaults is itself an NSNumber. So you are trying to bind a menu item to something in the NSUserDefaults that isn't there, and you're getting back nil. But nil is not an NSNumber, or any other kind of plist-able. So the exception is correct. My guess is that Cocoa is covering up the problem. It throws an exception (as you discovered by breaking on raise), but in this case I'm betting that it then proceeds to *handle* that exception (thinking to itself, well, this is nil, so I'll tell the menu item that the value is NO). You are breaking before the exception is handled so you're seeing the sausage being made. That's just a guess, but it explains why nothing gets logged - the exception never trickles up to the top level, for logging, because it's handled immediately after the point at which you are breaking. m. -- matt neuburg, phd = [email protected], <http://www.tidbits.com/matt/> A fool + a tool + an autorelease pool = cool! AppleScript: the Definitive Guide - Second Edition! http://www.tidbits.com/matt/default.html#applescriptthings _______________________________________________ Cocoa-dev mailing list ([email protected]) 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]
