Platforms to show: All Mac Windows Linux Cross-Platform

NSURLSessionDownloadTaskMBS class

Super class: NSURLSessionTaskMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Cocoa Networking MBS MacFrameworks Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes All
A URL session task that stores downloaded data to file.

An NSURLSessionDownloadTaskMBS is a concrete subclass of NSURLSessionTask. Most of the methods associated with this class are documented in NSURLSessionTaskMBS.

Download tasks directly write the server’s response data to a temporary file, providing your app with progress updates as data arrives from the server. When you use download tasks in background sessions, these downloads continue even when your app is suspended or is otherwise not running.

You can pause (cancel) download tasks and resume them later (assuming the server supports doing so). You can also resume downloads that failed because of network connectivity problems.

When you use a download task, your NSURLSessionMBS subclass receives several callbacks unique to download scenarios.

  • During download, the session periodically calls the downloadTaskDidWriteData event with status information.
  • Upon successful completion, the session calls the downloadTaskDidFinishDownloadingToURL event or completion handler. In that method, you must either open the file for reading or move it to a permanent location in your app’s sandbox container directory.
  • Upon unsuccessful completion, the session calls the taskDidCompleteWithError method or completion handler. Unlike NSURLSessionDataTaskMBS or NSURLSessionUploadTaskMBS, a download task reports server-side errors reported through HTTP status codes into corresponding NSError objects.
Subclass of the NSURLSessionTaskMBS class.
This is an abstract class. You can't create an instance, but you can get one from various plugin functions.

Super class NSURLSessionTaskMBS

States

Constant Value Description
StateCanceling 2 The task has received a cancel message.
The delegate may or may not have received a taskDidCompleteWithError message yet. A task in this state is not subject to timeouts.
StateCompleted 3 The task has completed (without being canceled), and the task's delegate receives no further callbacks. more
StateRunning 0 The task is currently being serviced by the session.
A task in this state is subject to the request and resource timeouts specified in the session configuration object.
StateSuspended 1 The task was suspended by the app.
No further processing takes place until the task is resumed. A task in this state is not subject to timeouts.

This class has no sub classes.

Some methods using this class:

Some events using this class:

Some examples using this class:

Blog Entries


The items on this page are in the following plugins: MBS MacFrameworks Plugin.


NSURLSessionDataTaskMBS   -   NSURLSessionMBS


The biggest plugin in space...