Cocoa sometimes raises "minor" exceptions without logging them
Cocoa sometimes raises "minor" exceptions without logging them
- Subject: Cocoa sometimes raises "minor" exceptions without logging them
- From: Jerry Krinock <email@hidden>
- Date: Wed, 17 Mar 2010 09:55:01 -0700
Near the end of -applicationDidFinishLaunching, I bind to a user default, like this:
[doxtusMenu bind:@"showStatusMenu"
toObject:[NSUserDefaults standardUserDefaults]
withKeyPath:constKeyShowStatusMenu
options:0] ;
This code works perfectly.
However, when I'd run this app with breakpoints on, this would trigger a break in +[NSException raise:format:arguments:] where I have a breakpoint (call stack below). I found that it only occurred when the user default for constKeyShowStatusMenu had never been set. I fixed the problem by adding constKeyShowStatusMenu to my "default defaults" which get registered prior to this, via -registerDefaults. OK.
I find it odd that this exception never get logged. Running without breakpoints enabled, it seemed like nothing was wrong. And I supposed it could be argued that nothing was wrong, since constKeyShowStatusMenu is a Boolean property, nil = NO, and I shouldn't really need to register that default default.
Apparently, Cocoa sometimes raises "minor" exceptions without logging them, so it's good idea to set a breakpoing in +[NSException raise:format:arguments:] and run with breakpoints enabled once in awhile.
#0 0x940ff0bd in +[NSException raise:format:arguments:]
#1 0x940ff0aa in +[NSException raise:format:]
#2 0x94b9d358 in -[NSObject(NSKeyValueCoding) setNilValueForKey:]
#3 0x94b9b702 in _NSSetNilValueForKey
#4 0x94ac1dd9 in _NSSetUsingKeyValueSetter
#5 0x94ac1d60 in -[NSObject(NSKeyValueCoding) setValue:forKey:]
#6 0x96b055e4 in -[NSObjectParameterBinder _updateObject:observedController:observedKeyPath:context:]
#7 0x96b04d81 in -[NSObjectParameterBinder _observeValueForKeyPath:ofObject:context:]
#8 0x96b049f9 in -[NSBinder _performConnectionEstablishedRefresh]
#9 0x96af7104 in -[NSObject(NSKeyValueBindingCreation) bind:toObject:withKeyPath:options:]
#10 0x000155f9 in -[BkmxAppDel finishLaunchingMore] at BkmxAppDel.m:964
#11 0x00015184 in -[BkmxAppDel applicationDidFinishLaunching:] at BkmxAppDel.m:901
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden