简体   繁体   English

UICollectionView崩溃

[英]Crash on UICollectionView

Good day, 美好的一天,

I am unable to replicate a crash but several of my live users are experiencing a crash. 我无法复制崩溃,但我的几个实时用户正在崩溃。 A report of the crash as downloaded from crashlytics is below. 从crashlytics下载的崩溃报告如下。 Can someone please help? 有人可以帮忙吗? Its happening to users on iOS12. 它发生在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

You probably have a synchronization issue with your data and propagating the insertions and deletions to the collectionview. 您可能对数据存在同步问题,并将插入和删除传播到集合视图。 You need to make sure that your datasource is not being modified while insert/delete cells is making changes to the collectionview. 当插入/删除单元格对集合视图进行更改时,您需要确保未修改数据源。

That means that if your listener wants to update your data, you need to make sure that the previous changes have been applied. 这意味着,如果您的侦听器想要更新您的数据,则需要确保已应用先前的更改。 You could do this using a semaphore. 你可以使用信号量来做到这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM