Platforms to show: All Mac Windows Linux Cross-Platform

NSURLSessionUploadTaskMBS class

Super class: NSURLSessionDataTaskMBS

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 uploads data to the network in a request body.

The NSURLSessionUploadTaskMBS class is a subclass of NSURLSessionDataTaskMBS, which in turn is a concrete subclass of NSURLSessionTaskMBS. The methods associated with the NSURLSessionUploadTaskMBS class are documented in NSURLSessionTaskMBS.
Upload tasks are used for making HTTP requests that require a request body (such as POST or PUT). They behave similarly to data tasks, but you create them by calling different methods on the session that are designed to make it easier to provide the content to upload. As with data tasks, if the server provides a response, upload tasks return that response as one or more MemoryBlock objects in memory.

Unlike data tasks, you can use upload tasks to upload content in the background.

When you create an upload task, you provide a NSURLRequestMBS instance that contains any additional headers that you might need to send alongside the upload, such as the content type, content disposition, and so on. In iOS, when you create an upload task for a file in a background session, the system copies that file to a temporary location and streams data from there.
While the upload is in progress, the task calls the session taskDidSendBodyData event in NSURLSessionMBS class periodically to provide you with status information.

When the upload phase of the request finishes, the task behaves like a data task, calling events on the session to provide you with the server’s response—headers, status code, content data, and so on.
Subclass of the NSURLSessionDataTaskMBS class.
This is an abstract class. You can't create an instance, but you can get one from various plugin functions.

Super class NSURLSessionDataTaskMBS

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 examples using this class:

Blog Entries


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


NSURLSessionTaskTransactionMetricsMBS   -   NSURLSessionWebSocketMessageMBS


The biggest plugin in space...