我遇到了崩溃,但我不确定是什么造成的。
我使用Twilio框架,一切正常,但我得到了一个奇怪的prod崩溃 我看起来像是一个字典相关的问题:
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000e711dbea8
Crashed: com.apple.root.background-qos
0 libobjc.A.dylib 0x182696654 object_getClass + 64
1 CoreFoundation 0x1833f3e18 _CFRelease + 1060
2 TestApp 0x100cae408 specialized _VariantDictionaryBuffer.nativeUpdateValue(_:forKey:) (TicketsManager.swift)
3 TestApp 0x100b4ba94 specialized ChatManager.getAndJoinDialog(roomId:onSuesscs:onFaild:) (ChatManager.swift:798)
4 TestApp 0x100c5e7f0 specialized ChatMessagesManager.getAllMessagesFromServerForTicket(_:) (ChatMessagesManager.swift:164)
5 TestApp 0x1009d7ca0 ChatViewController.loadAllMessagesFomServer() (ChatViewController.swift:460)
6 TestApp 0x1009feed8 partial apply for closure #1 in ChatViewController.viewWillAppear(_:) (ChatViewController.swift:234)
7 TestApp 0x100aee754 closure #1 in static Utils.performTaskOnMain(_:) (Utils.swift:84)
8 TestApp 0x1009b778c thunk for @callee_owned () -> () (QRCodeViewController.swift)
9 libdispatch.dylib 0x182dcd088 _dispatch_call_block_and_release + 24
10 libdispatch.dylib 0x182dcd048 _dispatch_client_callout + 16
11 libdispatch.dylib 0x182dda378 _dispatch_root_queue_drain + 1028
12 libdispatch.dylib 0x182dd9f10 _dispatch_worker_thread3 + 120
13 libsystem_pthread.dylib 0x183073120 _pthread_wqthread + 1268
14 libsystem_pthread.dylib 0x183072c20 start_wqthread + 4
TicketManager func:
func getAndJoinDialog(roomId : String,onSuesscs: @escaping (() -> Void),onFaild: @escaping (()-> Void)) {
if let channel = self.getDialog(roomId) {
self.addDialog(channel)
self.joinDialogWithBlock(channel, successBlock: onSuesscs, failBlock: { (_) in
onFaild()
})
return
}
self.chat?.channelsList()?.channel(withSidOrUniqueName: roomId, completion: { (result, channel) in
if result.isSuccessful() && channel != nil{
self.addDialog(channel!)
self.joinDialogWithBlock(channel!, successBlock: onSuesscs, failBlock: { (_) in
onFaild()
})
}else {
DDLogError("getAndJoinDialog error: \(String(describing: result.error))")
onFaild()
}
})
} <- **Crash on this line**
添加对话框功能
func addDialog(_ dialog:TCHChannel)
{
self.dialogs[dialog.sid ?? ""] = dialog
}
我不确定可能导致此次崩溃的原因