2

I have implemented FileProvider Extension.

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.**
}

   }
}

I am not able to get any UI handler in download delegates to update the progress and update the cell download button after successful download.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
AppleBee
  • 1,199
  • 12
  • 26

1 Answers1

1

To support progress display on download/upload progress, you need to do:

  1. Use NSURLSessionTask to download/upload files
  2. Use NSURLSession with backgroundSession ([NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:])
  3. Use [NSFileProviderManager registerURLSessionTask:forItemWithIdentifier:completionHandler:] to build task-identifier mapping.

Then the File Provider extension will show the progress on UI.

bummi
  • 27,123
  • 14
  • 62
  • 101