我收到我的用户通过邮件崩溃,并且我多次收到同样的崩溃。用户可以向我发送有关崩溃发生的崩溃的评论,但是他们中没有人对此发表任何评论。所以基本上,是一个错误,我不知道如何重现发生在十一月的九次。与NSCollectionView发生奇怪的崩溃(NSRangeException)
这个集合视图是我的程序的重要组成部分,所以大多数用户可能一直在使用它,导致这种崩溃几乎从不发生。没有与macOS版本相关的模式(它发生在不同的版本中)。
Application Specific Information:
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 0 beyond bounds for empty array'
terminating with uncaught exception of type NSException
abort() called
Application Specific Backtrace 1:
0 CoreFoundation 0x00007fff8fc7803c __exceptionPreprocess 172
1 libobjc.A.dylib 0x00007fff88e2876e objc_exception_throw 43
2 CoreFoundation 0x00007fff8fb4fbce -[__NSArrayI objectAtIndex:] 190
3 AppKit 0x00007fff8ea54f3e -[NSCollectionViewItem _copyConnectionsOfObject:prototypeItem:toObject:item:] 750
4 AppKit 0x00007fff8ea54c38 -[NSCollectionViewItem _copyConnectionsToItem:] 95
5 AppKit 0x00007fff8ea52e71 -[NSCollectionViewItem copyWithZone:] 487
6 AppKit 0x00007fff8ea52c20 -[NSCollectionView newItemForRepresentedObject:] 68
7 AppKit 0x00007fff8ea527b3 -[NSCollectionView _getItemsToDisplay] 1168
8 AppKit 0x00007fff8ea52205 -[NSCollectionView setContent:] 217
9 MyApp 0x000000010e3ae9d3 MyApp 117203
10 libdispatch.dylib 0x00007fff8cc2e323 _dispatch_call_block_and_release 12
11 libdispatch.dylib 0x00007fff8cc29c13 _dispatch_client_callout 8
12 libdispatch.dylib 0x00007fff8cc35cbf _dispatch_main_queue_callback_4CF 861
13 CoreFoundation 0x00007fff8fbcb3f9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ 9
14 CoreFoundation 0x00007fff8fb8668f __CFRunLoopRun 2159
15 CoreFoundation 0x00007fff8fb85bd8 CFRunLoopRunSpecific 296
16 HIToolbox 0x00007fff8bae056f RunCurrentEventLoopInMode 235
17 HIToolbox 0x00007fff8bae02ea ReceiveNextEventCommon 431
18 HIToolbox 0x00007fff8bae012b _BlockUntilNextEventMatchingListInModeWithFilter 71
19 AppKit 0x00007fff8e6f49bb _DPSNextEvent 978
20 AppKit 0x00007fff8e6f3f68 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] 346
21 AppKit 0x00007fff8e6e9bf3 -[NSApplication run] 594
22 AppKit 0x00007fff8e666354 NSApplicationMain 1832
23 libdyld.dylib 0x00007fff8ae8a5c9 start 1
如果有任何细节我错过了免费问,但考虑到我不能再现错误,这是很难说。
对于集合视图,请添加数据源方法。重要的一对是collectionView:numberOfItemsInSection:和collectionView:cellForItemAtIndexPath :.它们都使用相同状态的相同阵列是至关重要的。 – danh
这是来自macOS的内容数组布局,不使用这些函数。集合视图的内容仅通过'setContent:'函数进行更改。 – vitormm