|class||Cocoa Networking||MBS MacFrameworks Plugin||20.2||✅ Yes||❌ No||❌ No||✅ Yes||All|
The NSURLSessionTaskMBS class is the base class for tasks in a URL session. Tasks are always part of a session; you create a task by calling one of the task creation methods on a NSURLSession instance. The method you call determines the type of task.
- Use NSURLSessionMBS’s dataTaskWithURL and related methods to create NSURLSessionDataTaskMBS instances. Data tasks request a resource, returning the server’s response as one or more NSData objects in memory. They are supported in default, ephemeral, and shared sessions, but are not supported in background sessions.
- Use NSURLSessionMBS’s uploadTaskWithRequest and related methods to create NSURLSessionUploadTaskMBS instances. Upload tasks are like data tasks, except that they make it easier to provide a request body so you can upload data before retrieving the server’s response. Additionally, upload tasks are supported in background sessions.
- Use NSURLSessionMBS’s downloadTaskWithURL and related methods to create NSURLSessionDownloadTaskMBS instances. Download tasks download a resource directly to a file on disk. Download tasks are supported in any type of session.
- Use NSURLSessionMBS’s streamTaskWithHostName or streamTaskWithNetService to create NSURLSessionStreamTaskMBS instances. Stream tasks establish a TCP/IP connection from a host name and port or a net service object.
After you create a task, you start it by calling its resume method. The session then maintains a strong reference to the task until the request finishes or fails; you don’t need to maintain a reference to the task unless it’s useful for your app’s internal bookkeeping.
This is an abstract class. You can't create an instance, but you can get one from various plugin functions.
- 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
- 4 shared methods
- 4 constants
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.
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.
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.
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.
- class NSURLSessionDataTaskMBS
- class NSURLSessionDownloadTaskMBS
- class NSURLSessionStreamTaskMBS
- class NSURLSessionWebSocketTaskMBS
Some methods using this class:
- NSURLSessionMBS.Tasks as NSURLSessionTaskMBS()
Some events using this class:
- NSURLSessionMBS.taskDidCompleteWithError(task as NSURLSessionTaskMBS, error as NSErrorMBS)
- NSURLSessionMBS.taskDidFinishCollectingMetrics(task as NSURLSessionTaskMBS, metrics as NSURLSessionTaskMetricsMBS)
- NSURLSessionMBS.taskDidSendBodyData(task as NSURLSessionTaskMBS, bytesSent as Int64, totalBytesSent as Int64, totalBytesExpectedToSend as Integer)
- NSURLSessionMBS.taskIsWaitingForConnectivity(task as NSURLSessionTaskMBS)
- NSURLSessionMBS.taskWillPerformHTTPRedirection(task as NSURLSessionTaskMBS, response as NSURLResponseMBS, request as NSURLRequestMBS) as NSURLRequestMBS
Some examples using this class:
The items on this page are in the following plugins: MBS MacFrameworks Plugin.
MBS Xojo Plugins