UICollectionView崩溃

时间:2019-01-22 10:56:32

标签: ios objective-c xcode uicollectionview ios12

美好的一天,

我无法复制崩溃,但是我的一些实时用户遇到了崩溃。从crashlytics下载的崩溃报告如下。 有人可以帮忙吗?发生在iOS12上的用户。

Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                 0x220ee4ec4 __exceptionPreprocess
1  libobjc.A.dylib                0x2200b5a40 objc_exception_throw
2  CoreFoundation                 0x220dfab3c +[_CFXNotificationTokenRegistration keyCallbacks]
3  Foundation                     0x2218e91d0 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
4  UIKitCore                      0x24d55ed28 -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:isFocused:notify:]
5  UIKitCore                      0x24d562e14 -[UICollectionView _updateVisibleCellsNow:]
6  UIKitCore                      0x24d567eb4 -[UICollectionView layoutSubviews]
7  UIKitCore                      0x24e13b96c -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
8  QuartzCore                     0x2254e1b74 -[CALayer layoutSublayers]
9  QuartzCore                     0x2254e6b2c CA::Layer::layout_if_needed(CA::Transaction*)
10 UIKitCore                      0x24e126e58 -[UIView(Hierarchy) layoutBelowIfNeeded]
11 UIKitCore                      0x24e12da08 +[UIView(Animation) performWithoutAnimation:]
12 UIKitCore                      0x24debd174 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:]
13 UIKitCore                      0x24debd4bc -[UITableView _createPreparedCellForGlobalRow:willDisplay:]
14 UIKitCore                      0x24de88b94 -[UITableView _updateVisibleCellsNow:isRecursive:]
15 UIKitCore                      0x24de894fc -[UITableView _updateVisibleCellsNow:isRecursive:]
16 UIKitCore                      0x24dea6a80 -[UITableView layoutSubviews]
17 UIKitCore                      0x24e13b96c -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
18 QuartzCore                     0x2254e1b74 -[CALayer layoutSublayers]
19 QuartzCore                     0x2254e6b2c CA::Layer::layout_if_needed(CA::Transaction*)
20 QuartzCore                     0x22544544c CA::Context::commit_transaction(CA::Transaction*)
21 QuartzCore                     0x225473d7c CA::Transaction::commit()
22 QuartzCore                     0x225474be4 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*)
23 CoreFoundation                 0x220e747cc __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
24 CoreFoundation                 0x220e6f460 __CFRunLoopDoObservers
25 CoreFoundation                 0x220e6fa00 __CFRunLoopRun
26 CoreFoundation                 0x220e6f1f0 CFRunLoopRunSpecific
27 GraphicsServices               0x2230e8584 GSEventRunModal
28 UIKitCore                      0x24dc934c0 UIApplicationMain
29 Psychic Txt                    0x1020cd03c main (main.m:14)
30 libdyld.dylib                  0x22092ebb4 start

1 个答案:

答案 0 :(得分:0)

您的数据可能存在同步问题,并且会将插入和删除传播到collectionview。您需要确保在插入/删除单元格对collectionview进行更改时未修改数据源。

这意味着,如果您的侦听器想要更新您的数据,则需要确保已应用先前的更改。您可以使用信号量来做到这一点。