我有一個可重複的碰撞,在一個EXC_BREAKPOINT下面的圖像中結束,如:夫特MultipeerConnectivity碰撞DateComponents unconditionallyBridgeFromObjectiveC
步驟來重現墜毀:
- 連接兩個設備
- 使用func sendResource開始傳輸(位於resourceURL:URL, withName resourceName:String, toPeer peerID:MCPeerID, withCompletionHandler completionHandler:((Error?) - > Void)? =無) - >進度?
- 斷開通過調用FUNC斷開()
編輯發起的傳輸的設備:另一種重現崩潰,通過調用Progress.cancel()步驟:
- 連接兩個設備
- 開始轉移並存儲進度對象讓進度:進度= session.sendResource(...)
- 調用取消進度對象,導致崩潰o n中的其他設備progress.cancel()
我在該行didFinishReceivingResourceWithName代碼:
func session(_ session: MCSession, didFinishReceivingResourceWithName resourceName: String, fromPeer peerID: MCPeerID, at localURL: URL, withError error: Error?) {
// transfer to local URL
MusicDownloadRequestor.sharedInstance.finishReceivingSongUploadAtLocalURL(tempUrl: localURL)
}
看起來不像我的代碼是所謂的堆棧跟蹤...
* thread #25: tid = 0x806ec, 0x0000000100944af4 libswiftFoundation.dylib`static Foundation.DateComponents._unconditionallyBridgeFromObjectiveC (Swift.Optional<__ObjC.NSDateComponents>) -> Foundation.DateComponents with unmangled suffix "_merged" + 96, queue = 'com.apple.MCSession.callbackQueue', stop reason = EXC_BREAKPOINT (code=1, subcode=0x100944af4)
frame #0: 0x0000000100944af4 libswiftFoundation.dylib`static Foundation.DateComponents._unconditionallyBridgeFromObjectiveC (Swift.Optional<__ObjC.NSDateComponents>) -> Foundation.DateComponents with unmangled suffix "_merged" + 96
frame #1: 0x0000000100114c60 MyAppSwift`@objc NetworkManager.session(MCSession, didFinishReceivingResourceWithName : String, fromPeer : MCPeerID, at : URL, withError : Error?) ->() + 168 at NetworkManager.swift:0
frame #2: 0x00000001a1dda028 MultipeerConnectivity`__79-[MCSession syncCloseIncomingStream:forPeer:state:error:reason:removeObserver:]_block_invoke + 208
frame #3: 0x0000000100c05258 libdispatch.dylib`_dispatch_call_block_and_release + 24
frame #4: 0x0000000100c05218 libdispatch.dylib`_dispatch_client_callout + 16
frame #5: 0x0000000100c12aec libdispatch.dylib`_dispatch_queue_serial_drain + 1136
frame #6: 0x0000000100c08ce0 libdispatch.dylib`_dispatch_queue_invoke + 672
frame #7: 0x0000000100c14e2c libdispatch.dylib`_dispatch_root_queue_drain + 584
frame #8: 0x0000000100c14b78 libdispatch.dylib`_dispatch_worker_thread3 + 140
frame #9: 0x000000018c2a32a0 libsystem_pthread.dylib`_pthread_wqthread + 1288
frame #10: 0x000000018c2a2d8c libsystem_pthread.dylib`start_wqthread + 4
更新#1:加入堆棧跟蹤文本
更新#2:實測值的可能的引線在崩潰,here's another crash with unconditionallyBridgeFromObjectiveC
我認爲問題是URL傳遞給didFinishReceivingResourceWithName爲零,但該參數是非可選的。這是有道理的,因爲如果文件無法傳輸,那麼就不會有URL的最終安放位置。有什麼辦法可以解決這個問題或攔截錯誤?
我認爲這是一個蘋果的錯誤。有沒有人有做一個解決辦法的建議?
請將堆棧跟蹤添加爲文本。 –
@ AminNegm-Awad更新,謝謝! – user2821647