我在10.6中抛出了一个严重的异常,而10.7中的一切都很好。当调用menuitem的动作时,会生成以下日志。请让我知道为什么抛出以下异常。
此致 iSight的
23/04/12 6:26:15 PM MyApp[155] *** Assertion failure in -[NSComboBoxCell _objectValue:forString:errorDescription:], /SourceCache/AppKit/AppKit-1038.36/AppKit.subproj/NSCell.m:1531
23/04/12 6:26:15 PM MyApp[155] Invalid parameter not satisfying: aString != nil
23/04/12 6:26:25 PM MyApp[155] HIToolbox: ignoring exception '*** -[NSCFDictionary setObject:forKey:]: attempt to insert nil value (key: NSFont)' that raised inside Carbon event dispatch
CoreFoundation 0x99f3a6ca __raiseError + 41
libobjc.A.dylib 0x945e55a9 objc_exception_throw + 5
CoreFoundation 0x99f3a3f8 +[NSException raise:format:arguments:] + 13
CoreFoundation 0x99f3a36a +[NSException raise:format:] + 5
Foundation 0x9469d3eb -[NSCFDictionary setObject:forKey:] + 26
MyApp 0x000883df 0x0 + 55804
MyApp 0x000033d0 0x0 + 1326
MyApp 0x00029cf6 0x0 + 17125
AppKit 0x97443a26 -[NSApplication sendAction:to:from:] + 11
AppKit 0x974438d9 -[NSMenuItem _corePerformAction] + 43
0 AppKit 0x974435ca -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 17
1 AppKit 0x974434b6 -[NSMenu performActionForItemAtIndex:] + 6
2 AppKit 0x97443469 -[NSMenu _internalPerformActionForItemAtIndex:] + 5
3 AppKit 0x974433cf -[NSMenuItem
_internalPerformActionThroughMenuIfPossible] + 9
4 AppKit 0x97443313 -[NSCarbonMenuImpl
_carbonCommandProcessEvent:handlerCallRef:] + 33
5 AppKit 0x97437a55 NSSLMMenuEventHandler + 40
6 HIToolbox 0x90acac2f
_ZL23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec
+ 156
7 HIToolbox 0x90ac9ef6 _ZL30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec
+ 41
8 HIToolbox 0x90aec7f3 SendEventToEventTarget + 5
9 HIToolbox 0x90b18e87
_ZL18SendHICommandEventmPK9HICommandmmhPKvP20OpaqueEventTargetRefS5_PP14OpaqueEventRef
+ 44
0 HIToolbox 0x90b3db90 SendMenuCommandWithContextAndModifiers + 6
1 HIToolbox 0x90b3db47 SendMenuItemSelectedEvent + 12
2 HIToolbox 0x90b3da5d _ZL19FinishMenuSelectionP13SelectionDataP10MenuResultS2_ + 15
3 HIToolbox 0x90cbf364
_ZL19PopUpMenuSelectCoreP8MenuData5PointdS1_tjPK4RecttmS4_S4_PK10__CFStringPP13OpaqueMenuRefPt
+ 185
4 HIToolbox 0x90cbf6bb _HandlePopUpMenuSelection7 + 67
5 AppKit 0x976cf6e6 _NSSLMPopUpCarbonMenu3 + 393
6 AppKit 0x976cfa76 -[NSCarbonMenuImpl
_popUpContextMenu:withEvent:forView:withFont:] + 22
7 AppKit 0x97848945 -[NSMenu _popUpContextMenu:withEvent:forView:withFont:] + 27
8 AppKit 0x978489e4 -[NSMenu
_popUpContextMenu:withEvent:forView:] + 6
9 AppKit 0x978487b7 -[NSMenu _popUpMenuWithEvent:forView:] + 5
0 AppKit 0x97a3f65d -[NSView rightMouseDown:] + 10
1 AppKit 0x97730d1b -[NSControl _rightMouseUpOrDown:] + 53
2 AppKit 0x9751ab28 -[NSWindow sendEvent:] + 575
3 AppKit 0x9743360b -[NSApplication sendEvent:] + 643
4 AppKit 0x973c7253 -[NSApplication run] + 91
5 AppKit 0x973bf289 NSApplicationMain + 57
6 MyApp 0x00002a45 0x0 + 1082
7 ??? 0x00000002 0x0 + 2 )
23/04/12 6:26:37 PM MyApp[155] NSMenu received exception *** -[NSCFDictionary setObject:forKey:]: attempt to insert nil value (key: NSFont) during menu tracking. The exception will be ignored.
23/04/12 6:26:37 PM Dynamo[155] *** -[NSCFDictionary setObject:forKey:]: attempt to insert nil value (key: NSFont)
答案 0 :(得分:0)
在NSDictionary对象中,您无法设置 nil 值