Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/100.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS Swift-崩溃:com.apple.NSURLSession-delegate EXC_断点0x0000000102e35fc0_Ios_Swift_Thread Safety - Fatal编程技术网

iOS Swift-崩溃:com.apple.NSURLSession-delegate EXC_断点0x0000000102e35fc0

iOS Swift-崩溃:com.apple.NSURLSession-delegate EXC_断点0x0000000102e35fc0,ios,swift,thread-safety,Ios,Swift,Thread Safety,我们的应用程序具有pdf和音频文件的下载功能。我在后台模式下添加了下载功能,但应用程序有时会崩溃,我无法重现该步骤。这是firebase坠毁报告 Crashed: com.apple.NSURLSession-delegate 0 ios 0x102e35fc0 specialized DownloadSessionDelegate.urlSession(_:dataTask:didReceive:completionHandler:) + 189 (<

我们的应用程序具有pdf和音频文件的下载功能。我在后台模式下添加了下载功能,但应用程序有时会崩溃,我无法重现该步骤。这是firebase坠毁报告

Crashed: com.apple.NSURLSession-delegate
0  ios                  0x102e35fc0 specialized DownloadSessionDelegate.urlSession(_:dataTask:didReceive:completionHandler:) + 189 (<compiler-generated>:189)
1  ios                  0x102e32780 @objc DownloadSessionDelegate.urlSession(_:dataTask:didReceive:completionHandler:) + 4339345280 (<compiler-generated>:4339345280)
2  CFNetwork                      0x1810db158 _CFNetworkHTTPConnectionCacheSetLimit + 155124
3  libdispatch.dylib              0x180573298 _dispatch_call_block_and_release + 24
4  libdispatch.dylib              0x180574280 _dispatch_client_callout + 16
5  libdispatch.dylib              0x18051cdcc _dispatch_lane_serial_drain$VARIANT$mp + 612
6  libdispatch.dylib              0x18051d8d8 _dispatch_lane_invoke$VARIANT$mp + 472
7  libdispatch.dylib              0x180527338 _dispatch_workloop_worker_thread + 712
8  libsystem_pthread.dylib        0x1c83bf5a4 _pthread_wqthread + 272
9  libsystem_pthread.dylib        0x1c83c2874 start_wqthread + 8
下面是DownloadSessionDelegate.swift中的完成处理程序。我不确定是什么问题

    //MARK: completion handler
    func addCompletionHandler(_ handler: @escaping CompleteHandlerBlock, identifier: String) {
        
        if identifier.isEmpty { return }
        
        DispatchQueue.global().async {
            self.handlerQueue[identifier] = handler
        }
        
    }

有什么解决办法吗?
    //MARK: completion handler
    func addCompletionHandler(_ handler: @escaping CompleteHandlerBlock, identifier: String) {
        
        if identifier.isEmpty { return }
        
        DispatchQueue.global().async {
            self.handlerQueue[identifier] = handler
        }
        
    }