Terminating a Download

An ongoing or suspended file download can be manually terminated. Once terminated, you will not be able to resume the download.

The following sample code shows how to terminate a download.

Swift 3:

// Assume that mUploader is the downloader you want to terminate.

// Terminate downloading.
do{
  try mDownloader.terminate()
} catch let error as NSError {
  // Handle the error.
  return
}

Objective-C:

// Assume that mDownloader is the downloader you want to terminate.

// Terminate uploading.
NSError *error = nil;
[mDownloader terminate:&error];
if (error != nil) {
  // Handle the error.
  return;
}

Call the terminate() method to terminate a download. An error will be returned if you attempt to terminate a finished download.