CollectionView cellForItemAt IndexPath中的SIGTRAP(TRAP_BRKPT)崩溃

时间:2018-09-02 12:42:50

标签: ios swift core-data

我在生产应用程序中遇到了这个奇怪的崩溃。崩溃很少发生,我无法重现。

Crashed: com.apple.root.background-qos
0  AppName                    0x104a4c040 ViewController.(collectionView(UICollectionView, cellForItemAt : IndexPath) -> UICollectionViewCell).(closure #1) (ViewController.swift:1018)
1  AppName                    0x104a95270 _T0Ieg_IeyB_TR (Gif.swift)
2  libdispatch.dylib              0x1821cd088 _dispatch_call_block_and_release + 24
3  libdispatch.dylib              0x1821cd048 _dispatch_client_callout + 16
4  libdispatch.dylib              0x1821da378 _dispatch_root_queue_drain + 1028
5  libdispatch.dylib              0x1821d9f10 _dispatch_worker_thread3 + 120
6  libsystem_pthread.dylib        0x182473130 _pthread_wqthread + 1268
7  libsystem_pthread.dylib        0x182472c30 start_wqthread + 4

我正在使用后台队列更新collectionView的cellForItemAt IndexPath中的核心数据对象。我正在使用父子托管对象上下文来更新核心数据。

在1018行中,我有

DispatchQueue.global(qos: .background).async {
    DatabaseOperations.sharedInstance.incomingMessageRead(true, message.messageId!)
            }

哪个位于cellForItem方法中。谁能让我知道是什么原因导致撞车事故,以及如何防止撞车事故发生?谢谢。

1 个答案:

答案 0 :(得分:0)

通常sigtrap代表意外的零,所以您可以警惕这一部分:

message.messageId!

相关问题