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 |
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.
- 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. |
Sub classes:
Some methods using this class:
- NSURLSessionMBS.dataTaskWithRequest(request as NSURLRequestMBS) as NSURLSessionDataTaskMBS
- NSURLSessionMBS.dataTaskWithRequest(request as NSURLRequestMBS, handler as NSURLSessionDataTaskCompletedMBS, tag as Variant = nil) as NSURLSessionDataTaskMBS
- NSURLSessionMBS.dataTaskWithURL(URL as String) as NSURLSessionDataTaskMBS
- NSURLSessionMBS.dataTaskWithURL(URL as String, handler as NSURLSessionDataTaskCompletedMBS, tag as Variant = nil) as NSURLSessionDataTaskMBS
- NSURLSessionMBS.downloadTaskWithRequest(request as NSURLRequestMBS, handler as NSURLSessionUploadTaskCompletedMBS, tag as Variant = nil) as NSURLSessionDataTaskMBS
- NSURLSessionMBS.downloadTaskWithResumeData(resumeData as MemoryBlock, handler as NSURLSessionUploadTaskCompletedMBS, tag as Variant = nil) as NSURLSessionDataTaskMBS
- NSURLSessionMBS.downloadTaskWithURL(URL as String, handler as NSURLSessionUploadTaskCompletedMBS, tag as Variant = nil) as NSURLSessionDataTaskMBS
- NSURLSessionMBS.uploadTaskWithRequest(request as NSURLRequestMBS, data as MemoryBlock, handler as NSURLSessionUploadTaskCompletedMBS, tag as Variant = nil) as NSURLSessionDataTaskMBS
- NSURLSessionMBS.uploadTaskWithRequest(request as NSURLRequestMBS, file as FolderItem, handler as NSURLSessionUploadTaskCompletedMBS, tag as Variant = nil) as NSURLSessionDataTaskMBS
Some events using this class:
- NSURLSessionMBS.dataTaskDidBecomeDownloadTask(dataTask as NSURLSessionDataTaskMBS, downloadTask as NSURLSessionDownloadTaskMBS)
- NSURLSessionMBS.dataTaskDidBecomeStreamTask(dataTask as NSURLSessionDataTaskMBS, downloadTask as NSURLSessionStreamTaskMBS)
- NSURLSessionMBS.dataTaskDidReceiveData(dataTask as NSURLSessionDataTaskMBS, data as MemoryBlock)
- NSURLSessionMBS.dataTaskDidReceiveResponse(dataTask as NSURLSessionDataTaskMBS, response as NSURLResponseMBS) as Integer
- NSURLSessionMBS.dataTaskWillCacheResponse(dataTask as NSURLSessionDataTaskMBS, proposedResponse as NSCachedURLResponseMBS) as NSCachedURLResponseMBS
Some examples using this class:
Blog Entries
The items on this page are in the following plugins: MBS MacFrameworks Plugin.
NSURLSessionConfigurationMBS - NSURLSessionDownloadTaskMBS