gpt4 book ai didi

ios - SIGTRAP(TRAP_BRKPT) CollectionView cellForItemAt IndexPath 中崩溃

转载 作者:行者123 更新时间:2023-11-30 11:11:36 24 4
gpt4 key购买 nike

我在我的生产应用程序中遇到了奇怪的崩溃。崩溃并不频繁,我无法重现它。

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 方法中。谁能告诉我导致崩溃的原因以及我可以采取哪些措施来防止崩溃?谢谢。

最佳答案

通常 sigtrap 表示意外的 nil,所以你可以保护这部分:


消息.messageId!

关于ios - SIGTRAP(TRAP_BRKPT) CollectionView cellForItemAt IndexPath 中崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52137139/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com