Suspending a Download

An ongoing file download can be manually suspended.

The following sample code shows how to suspend an ongoing file download.

Swift 3:

// Assume that "mDownloader" handles the ongoing download.

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

Objective-C:

// Assume that "mDownloader" handles the ongoing download.

// Suspend downloading.
NSError *error = nil;
[mDownloader suspend:&error];
if (error != nil) {
  // Handle the error.
  return;
}

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