当我的窗口正在加载时,我遇到了崩溃(下面的回溯)。似乎表明 Core Animation 发生了一些事情,但我没有启动任何动画,只是显示窗口。
将特定堆栈视图的剪切阻力从 1000 更改为 750 避免了一段时间的崩溃,但现在它又回来了,尽管它现在发生在不同的点。
我尝试创建我的布局的简化版本来演示这里的问题,但我无法重现该问题。所以我所能做的就是向你推荐完整的应用程序:https : //github.com/Uncommon/Xit/tree/0b70352239b6fbaba6d26c952ce6de4f111a5346
崩溃回溯:
#0 0x00007fff4339c454 in -[NSApplication _crashOnException:] ()
#1 0x00007fff43968cb1 in __65+[CATransaction(NSCATransaction) NS_setFlushesWithDisplayRefresh]_block_invoke ()
#2 0x00007fff45af4417 in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ ()
#3 0x00007fff45af433f in __CFRunLoopDoObservers ()
#4 0x00007fff45ad68b8 in __CFRunLoopRun ()
#5 0x00007fff45ad6153 in CFRunLoopRunSpecific ()
#6 0x00007fff44dc0d96 in RunCurrentEventLoopInMode ()
#7 0x00007fff44dc0a0f in ReceiveNextEventCommon ()
#8 0x00007fff44dc0884 in _BlockUntilNextEventMatchingListInModeWithFilter ()
#9 0x00007fff43071a73 in _DPSNextEvent ()
#10 0x00007fff43807e34 in -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] ()
#11 0x00007fff43066885 in -[NSApplication run] ()
#12 0x00007fff43035a72 in NSApplicationMain ()
#13 0x0000000100005794 in main at /Users/i58922/Developer/Personal/Xit/Xit/main.m:5
#14 0x00007fff6d91d015 in start ()
#15 0x00007fff6d91d015 in start ()
Run Code Online (Sandbox Code Playgroud)
在这种情况下可能的罪魁祸首是什么?我怎样才能缩小范围?这是一个有点复杂的窗口,带有嵌套的拆分视图等。
我最终将范围缩小到我调用tableView.view(atColumn:,row:,makeIfNecessary:)
的行索引越界这一事实。这导致了一个异常,然后在崩溃之前将堆栈展开到一个无法识别的点。
如果我打开了“All Objective-C Exceptions”断点,我会更快地找到它,因为它在[NSApplication _crashOnException:]
.