Ios NSFileProviderExtension扩展显示下载进度

Ios NSFileProviderExtension扩展显示下载进度,ios,swift,fileprovider-extension,Ios,Swift,Fileprovider Extension,我已经实现了FileProvider扩展 class MyProviderExtension: NSFileProviderExtension { override func startProvidingItem(at url: URL, completionHandler: ((_ error: Error?) -> Void)?) { downloading file using URL and implemented download delegat

我已经实现了FileProvider扩展

class MyProviderExtension: NSFileProviderExtension {

    override func startProvidingItem(at url: URL, completionHandler: ((_ error: Error?) -> Void)?) {
            downloading file using URL and implemented download delegates

// Download Delegate
    func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didWriteData bytesWritten: Int64, totalBytesWritten: Int64, totalBytesExpectedToWrite: Int64) {

**// How can I upload the download progress here.**
}

   }
}

成功下载后,我无法让下载代理中的任何UI处理程序更新进度并更新单元格下载按钮。

要支持下载/上载进度上的进度显示,您需要执行以下操作:

  • 使用NSURLSessionTask下载/上载文件
  • 将NSURLSession与backgroundSession一起使用([NSURLSessionConfiguration BackgroundSessionConfiguration WithIdentifier:)
  • 使用[NSFileProviderManager registerURLSessionTask:forItemWithIdentifier:completionHandler:]构建任务标识符映射

  • 然后,文件提供程序扩展名将在UI上显示进度。

    如果需要执行多个NSURLSessionTask才能完成下载,我们该怎么办?