Cancels a download and calls a callback with resume data for later use.
- iOS 7.0+
- macOS 10.9+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
A completion handler that is called when the download has been successfully canceled.
If the download is resumable, the completion handler is provided with a
resumeobject. Your app can later pass this object to a session’s
Task(with Resume Data:)
downloadmethod to create a new task that resumes the download where it left off.
Task(with Resume Data: completion Handler:)
This block is not guaranteed to execute in a particular thread context. As such, you may want specify an appropriate dispatch queue in which to perform any work.
A download can be resumed only if the following conditions are met:
The resource has not changed since you first requested it
The task is an HTTP or HTTPS
The server provides either the
Last-Modifiedheader (or both) in its response
The server supports byte-range requests
The temporary file hasn’t been deleted by the system in response to disk space pressure