此问题不应与特定问题有关,有关详细信息,请参阅this meta post。
假设我有一个NSTableView,其中一列已将Value绑定到ArrayController(绑定到窗口控制器上的属性)。我得到了一个EXC_BAD_ACCESS。
问题是如何调试它。我想到了两个步骤:
NSZombieEnabled
。两者都没有帮助:
#0 0x00007fff833f6696 in ___forwarding___ ()
#1 0x00007fff833f2a38 in __forwarding_prep_0___ ()
#2 0x00007fff89be9d08 in -[NSValueBinder displayValueForObjectValue:] ()
#3 0x00007fff89be9ab7 in -[NSValueBinder _adjustObject:mode:observedController:observedKeyPath:context:editableState:adjustState:] ()
#4 0x00007fff89d47e75 in -[NSValueBinder updateTableColumnDataCell:forDisplayAtIndex:] ()
#5 0x00007fff89d47d83 in -[NSTextValueBinder updateTableColumnDataCell:forDisplayAtIndex:] ()
#6 0x00007fff89d47d30 in -[_NSBindingAdaptor tableColumn:willDisplayCell:row:] ()
#7 0x00007fff89c31b00 in -[NSTableView preparedCellAtColumn:row:] ()
#8 0x00007fff89c4a963 in -[NSTableView _drawContentsAtRow:column:withCellFrame:] ()
#9 0x00007fff89c499fc in -[NSTableView drawRow:clipRect:] ()
#10 0x00007fff89c492ef in -[NSTableView drawRowIndexes:clipRect:] ()
#11 0x00007fff89c47c9c in -[NSTableView drawRect:] ()
#12 0x00007fff89c3dd75 in -[NSView _drawRect:clip:] ()
#13 0x00007fff89c3b54b in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] ()
#14 0x00007fff89c3bed6 in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] ()
#15 0x00007fff89c3bed6 in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] ()
#16 0x00007fff89c3bed6 in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] ()
#17 0x00007fff89c3bed6 in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] ()
#18 0x00007fff89c3bed6 in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] ()
#19 0x00007fff89c3bed6 in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] ()
#20 0x00007fff89c3ab2c in -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] ()
#21 0x00007fff89c373de in -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] ()
#22 0x00007fff89bb0c0e in -[NSView displayIfNeeded] ()
#23 0x00007fff89bababa in _handleWindowNeedsDisplay ()
#24 0x00007fff833e3b07 in __CFRunLoopDoObservers ()
#25 0x00007fff833bf434 in __CFRunLoopRun ()
#26 0x00007fff833bed8f in CFRunLoopRunSpecific ()
#27 0x00007fff83d0a7ee in RunCurrentEventLoopInMode ()
#28 0x00007fff83d0a551 in ReceiveNextEventCommon ()
#29 0x00007fff83d0a4ac in BlockUntilNextEventMatchingListInMode ()
#30 0x00007fff89b80eb2 in _DPSNextEvent ()
#31 0x00007fff89b80801 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#32 0x00007fff89b4668f in -[NSApplication run] ()
#33 0x00007fff89b3f3b0 in NSApplicationMain ()
#34 0x0000000100001789 in main (argc=1, argv=0x7fff5fbff628) at /redacted/main.m:13
这只告诉我EXC_BAD_ACCESS是由表视图的绑定引起的。绑定正在访问一些不存在的变量。启用NSZombieEnabled
告诉我访问的变量是'CFString'类型,显然我需要使用多个字符串,所以这些信息也没有用。我该怎么办?