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 |
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.
- method Constructor Private
Super class NSURLSessionDataTaskMBS
- method Constructor Private
Super class NSURLSessionTaskMBS
- 17 properties
- property countOfBytesClientExpectsToReceive as Int64
- property countOfBytesClientExpectsToSend as Int64
- property countOfBytesExpectedToReceive as Int64
- property countOfBytesExpectedToSend as Int64
- property countOfBytesReceived as Int64
- property countOfBytesSent as Int64
- property currentRequest as NSURLRequestMBS
- property earliestBeginDate as Date
- property earliestBeginDateTime as DateTime
- property error as NSErrorMBS
- property Handle as Integer
- property originalRequest as NSURLRequestMBS
- property Priority as Single
- property response as NSURLResponseMBS
- property state as Integer
- property taskDescription as String
- property taskIdentifier as UInt64
- 5 methods
- method Cancel
- method Constructor Private
- method copy as NSURLSessionTaskMBS
- method resume
- method suspend
- 4 shared methods
- shared method available as Boolean
- shared method PriorityDefault as Single
- shared method PriorityHigh as Single
- shared method PriorityLow as Single
- 4 constants
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:
- NSURLSessionMBS.uploadTaskWithRequest(request as NSURLRequestMBS, data as MemoryBlock) as NSURLSessionUploadTaskMBS
- NSURLSessionMBS.uploadTaskWithRequest(request as NSURLRequestMBS, file as folderItem) as NSURLSessionUploadTaskMBS
- NSURLSessionMBS.uploadTaskWithStreamedRequest(request as NSURLRequestMBS) as NSURLSessionUploadTaskMBS
Some examples using this class:
Blog Entries
The items on this page are in the following plugins: MBS MacFrameworks Plugin.
NSURLSessionTaskTransactionMetricsMBS - NSURLSessionWebSocketMessageMBS