Platforms to show: All Mac Windows Linux Cross-Platform

NSURLSessionDataTaskMBS 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
Function: A URL session task that returns downloaded data directly to the app in memory.
A NSURLSessionDataTaskMBS is a concrete subclass of NSURLSessionTaskMBS. The methods in the NSURLSessionDataTaskMBS class are documented in NSURLSessionTaskMBS.

A data task returns data directly to the app (in memory) as one or more NSData objects. When you use a data task:

  • During upload of the body data (if your app provides any), the session periodically calls the taskDidSendBodyData event with status information.
  • After receiving an initial response, the session calls the dataTaskDidReceiveResponse event to let you examine the status code and headers, and optionally convert the data task into a download task.
  • During the transfer, the session calls dataTaskDidReceiveData event to provide your app with the content as it arrives.
  • Upon completion, the session calls the dataTaskWillCacheResponse event to let you determine whether the response should be cached.

For examples of using data tasks for fetching and uploading data, see Fetching Website Data into Memory and Uploading Data to a Website on Apple website.
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.

Feedback, Comments & Corrections

Super class NSURLSessionTaskMBS


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.
If the task completed successfully, the task’s error property is nil. Otherwise, it provides an error object that tells what went wrong. A task in this state is not subject to timeouts.
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.

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.

NSURLSessionConfigurationMBS   -   NSURLSessionDownloadTaskMBS

The biggest plugin in space...

MBS Xojo blog

Start Chat