Platforms to show: All Mac Windows Linux Cross-Platform
Back to NSURLSessionMBS class.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
See also:
NSURLSessionMBS.Constructor(configuration as NSURLSessionConfigurationMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
configuration: A configuration object that specifies certain behaviors, such as caching policies, timeouts, proxies, pipelining, TLS versions to support, cookie policies, credential storage, and so on.
See NSURLSessionConfigurationMBS class for more information.
See also:
NSURLSessionMBS.dataTaskWithRequest(request as NSURLRequestMBS) as NSURLSessionDataTaskMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
request: A URL request object that provides request-specific information such as the URL, cache policy, request type, and body data or body stream.
Returns he new session data task.
By creating a task based on a request object, you can tune various aspects of the task’s behavior, including the cache policy and timeout interval.
After you create the task, you must start it by calling its resume method.
See also:
NSURLSessionMBS.dataTaskWithRequest(request as NSURLRequestMBS, handler as NSURLSessionDataTaskCompletedMBS, tag as Variant = nil) as NSURLSessionDataTaskMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
request: A URL request object that provides the URL, cache policy, request type, body data or body stream, and so on.
completionHandler: The completion handler to call when the load request is complete.
See also:
NSURLSessionMBS.dataTaskWithURL(URL as String) as NSURLSessionDataTaskMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
URL: The URL to be retrieved.
After you create the task, you must start it by calling its resume method. The task calls methods on the session’s delegate to provide you with the response metadata, response data, and so on.
See also:
NSURLSessionMBS.dataTaskWithURL(URL as String, handler as NSURLSessionDataTaskCompletedMBS, tag as Variant = nil) as NSURLSessionDataTaskMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
url: The URL to be retrieved.
handler: The completion handler to call when the load request is complete.
See also:
NSURLSessionMBS.downloadTaskWithRequest(request as NSURLRequestMBS) as NSURLSessionDownloadTaskMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
request: A URL request object that provides the URL, cache policy, request type, body data or body stream, and so on.
Returns the new session download task.
By creating a task based on a request object, you can tune various aspects of the task’s behavior, including the cache policy and timeout interval.
After you create the task, you must start it by calling its resume method. The task calls methods on the session’s delegate to provide you with progress notifications, the location of the resulting temporary file, and so on.
See also:
NSURLSessionMBS.downloadTaskWithRequest(request as NSURLRequestMBS, handler as NSURLSessionUploadTaskCompletedMBS, tag as Variant = nil) as NSURLSessionDataTaskMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
request: A URL request object that provides the URL, cache policy, request type, body data or body stream, and so on.
Handler: The completion handler to call when the load request is complete.
See also:
NSURLSessionMBS.downloadTaskWithResumeData(resumeData as MemoryBlock) as NSURLSessionDownloadTaskMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
resumeData: A data object that provides the data necessary to resume a download.
After you create the task, you must start it by calling its resume method.
This method is equivalent to the downloadTaskWithResumeData:completionHandler: with a nil completion handler. For detailed usage information, including ways to obtain a resume data object, see that method.
See also:
NSURLSessionMBS.downloadTaskWithResumeData(resumeData as MemoryBlock, handler as NSURLSessionUploadTaskCompletedMBS, tag as Variant = nil) as NSURLSessionDataTaskMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
resumeData: A data object that provides the data necessary to resume the download.
Handler: The completion handler to call when the load request is complete.
See also:
NSURLSessionMBS.downloadTaskWithURL(URL as String) as NSURLSessionDownloadTaskMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
url: The URL to download.
After you create the task, you must start it by calling its resume method.
See also:
Some examples using this method:
NSURLSessionMBS.downloadTaskWithURL(URL as String, handler as NSURLSessionUploadTaskCompletedMBS, tag as Variant = nil) as NSURLSessionDataTaskMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
url: An URL that provides the URL to download.
Handler: The completion handler to call when the load request is complete.
See also:
NSURLSessionMBS.finishTasksAndInvalidate
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
This method returns immediately without waiting for tasks to finish. Once a session is invalidated, new tasks cannot be created in the session, but existing tasks continue until completion. After the last task finishes and the session makes the last delegate call related to those tasks, the session calls the DidBecomeInvalidWithError event, then breaks references to the delegate and callback objects. After invalidation, session objects cannot be reused.
To cancel all outstanding tasks, call invalidateAndCancel instead.
Important
Calling this method on the session returned by the sharedSession method has no effect.
NSURLSessionMBS.flush(Handler as NSURLSessionFlushCompletedMBS = nil, tag as variant = nil)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Handler: The completion handler to call when the flush operation is complete.
NSURLSessionMBS.invalidateAndCancel
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Once invalidated, references to the delegate and callback objects are broken. After invalidation, session objects cannot be reused.
To allow outstanding tasks to run until completion, call finishTasksAndInvalidate instead.
Important
Calling this method on the session returned by the sharedSession method has no effect.
Some examples using this method:
NSURLSessionMBS.reset(Handler as NSURLSessionResetCompletedMBS = nil, tag as variant = nil)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Empties all cookies, caches and credential stores, removes disk files, flushes in-progress downloads to disk, and ensures that future requests occur on a new socket.
Handler: The completion handler to call when the reset operation is complete.
NSURLSessionMBS.streamTaskWithHostName(hostname as String, Port as Integer) as NSURLSessionStreamTaskMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
hostname: The hostname of the connection endpoint.
port: The port of the connection endpoint.
Returns the new session stream task.
After you create the task, you must start it by calling its resume method.
Some examples using this method:
NSURLSessionMBS.Tasks as NSURLSessionTaskMBS()
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Please use the asynchronous variant if possible.
See also:
NSURLSessionMBS.Tasks(Handler as NSURLSessionTasksCompletedMBS, tag as variant = nil)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Handler: The completion handler to call with the list of tasks. This handler is executed on the delegate queue.
The arrays passed to the completion handler contain any tasks that you have created within the session, not including any tasks that have been invalidated after completing, failing, or being cancelled.
See also:
NSURLSessionMBS.uploadTaskWithRequest(request as NSURLRequestMBS, data as MemoryBlock) as NSURLSessionUploadTaskMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
request: A URL request object that provides the URL, cache policy, request type, and so on. The body stream and body data in this request object are ignored.
Data: The body data for the request.
Returns the new session upload task.
An HTTP upload request is any request that contains a request body, such as a POST or PUT request. Upload tasks require you to create a request object so that you can provide metadata for the upload, like HTTP request headers.
After you create the task, you must start it by calling its resume method. The task calls methods on the session’s delegate to provide you with the upload’s progress, response metadata, response data, and so on.
See also:
- uploadTaskWithRequest(request as NSURLRequestMBS, data as MemoryBlock, handler as NSURLSessionUploadTaskCompletedMBS, tag as Variant = nil) as NSURLSessionDataTaskMBS
- uploadTaskWithRequest(request as NSURLRequestMBS, file as folderItem) as NSURLSessionUploadTaskMBS
- uploadTaskWithRequest(request as NSURLRequestMBS, file as FolderItem, handler as NSURLSessionUploadTaskCompletedMBS, tag as Variant = nil) as NSURLSessionDataTaskMBS
Some examples using this method:
NSURLSessionMBS.uploadTaskWithRequest(request as NSURLRequestMBS, data as MemoryBlock, handler as NSURLSessionUploadTaskCompletedMBS, tag as Variant = nil) as NSURLSessionDataTaskMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
request: A URL request object that provides the URL, cache policy, request type, and so on. The body stream and body data in this request object are ignored.
bodyData: The body data for the request.
Handler: The completion handler to call when the load request is complete.
Returns the new session upload task.
An HTTP upload request is any request that contains a request body, such as a POST or PUT request. Upload tasks require you to create a request object so that you can provide metadata for the upload, like HTTP request headers.
Unlike uploadTaskWithRequest, this method returns the response body after it has been received in full, and does not require you to write a custom delegate to obtain the response body.
By using a completion handler, the task bypasses calls to delegate methods for response and data delivery, and instead provides any resulting data, response, or error inside the completion handler. Delegate methods for handling authentication challenges, however, are still called.
Typically you pass a nil completion handler only when creating tasks in sessions whose delegates include a dataTaskDidReceiveData method. However, if you do not need the response data, use key-value observing to watch for changes to the task’s status to determine when it completes.
After you create the task, you must start it by calling its resume method.
If the request completes successfully, the data parameter of the completion handler block contains the resource data, and the error parameter is nil. If the request fails, the data parameter is nil, and the error parameter contains information about the failure. If a response from the server is received, regardless of whether the request completes successfully or fails, the response parameter contains that information.
See also:
- uploadTaskWithRequest(request as NSURLRequestMBS, data as MemoryBlock) as NSURLSessionUploadTaskMBS
- uploadTaskWithRequest(request as NSURLRequestMBS, file as folderItem) as NSURLSessionUploadTaskMBS
- uploadTaskWithRequest(request as NSURLRequestMBS, file as FolderItem, handler as NSURLSessionUploadTaskCompletedMBS, tag as Variant = nil) as NSURLSessionDataTaskMBS
NSURLSessionMBS.uploadTaskWithRequest(request as NSURLRequestMBS, file as folderItem) as NSURLSessionUploadTaskMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
request: A URL request object that provides the URL, cache policy, request type, and so on. The body stream and body data in this request object are ignored.
file: The file to upload.
Returns the new session upload task.
An HTTP upload request is any request that contains a request body, such as a POST or PUT request. Upload tasks require you to create a request object so that you can provide metadata for the upload, like HTTP request headers.
After you create the task, you must start it by calling its resume method. The task calls methods on the session’s delegate to provide you with the upload’s progress, response metadata, response data, and so on.
See also:
- uploadTaskWithRequest(request as NSURLRequestMBS, data as MemoryBlock) as NSURLSessionUploadTaskMBS
- uploadTaskWithRequest(request as NSURLRequestMBS, data as MemoryBlock, handler as NSURLSessionUploadTaskCompletedMBS, tag as Variant = nil) as NSURLSessionDataTaskMBS
- uploadTaskWithRequest(request as NSURLRequestMBS, file as FolderItem, 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
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
request: An NSURLRequestMBS instance that provides the URL, cache policy, request type, and so on. The body stream and body data in this request object are ignored.
file: The file to upload.
Handler: The completion handler to call when the load request is complete.
An HTTP upload request is any request that contains a request body, such as a POST or PUT request. Upload tasks require you to create a request object so that you can provide metadata for the upload, like HTTP request headers.
Unlike uploadTaskWithRequest, this method returns the response body after it has been received in full, and does not require you to write a custom delegate to obtain the response body.
By using a completion handler, the task bypasses calls to delegate methods for response and data delivery, and instead provides any resulting data, response, or error inside the completion handler. Delegate methods for handling authentication challenges, however, are still called.
Typically you usually pass a nil completion handler only when creating tasks in sessions whose delegates include a dataTaskDidReceiveData method. However, if you do not need the response data, use key-value observing to watch for changes to the task’s status to determine when it completes.
After you create the task, you must start it by calling its resume method.
If the request completes successfully, the data parameter of the completion handler block contains the resource data, and the error parameter is nil. If the request fails, the data parameter is nil, and the error parameter contains information about the failure. If a response from the server is received, regardless of whether the request completes successfully or fails, the response parameter contains that information.
See also:
- uploadTaskWithRequest(request as NSURLRequestMBS, data as MemoryBlock) as NSURLSessionUploadTaskMBS
- uploadTaskWithRequest(request as NSURLRequestMBS, data as MemoryBlock, handler as NSURLSessionUploadTaskCompletedMBS, tag as Variant = nil) as NSURLSessionDataTaskMBS
- uploadTaskWithRequest(request as NSURLRequestMBS, file as folderItem) as NSURLSessionUploadTaskMBS
NSURLSessionMBS.uploadTaskWithStreamedRequest(request as NSURLRequestMBS) as NSURLSessionUploadTaskMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
request: A URL request object that provides the URL, cache policy, request type, and so on. The body stream and body data in this request object are ignored, and the session calls its taskNeedNewBodyStream event to provide the body data.
Returns the new session upload task.
An HTTP upload request is any request that contains a request body, such as a POST or PUT request. Upload tasks require you to provide a request object so that you can provide metadata for the upload, such as HTTP request headers.
After you create the task, you must start it by calling its resume method. The task calls methods on the session’s delegate to provide you with the upload’s progress, response metadata, response data, and so on. The session must have a taskNeedNewBodyStream event that provides the body data to upload.
NSURLSessionMBS.webSocketTaskWithRequest(request as NSURLRequestMBS) as NSURLSessionWebSocketTaskMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
request: A URL request that indicates a WebSockets endpoint with which to connect.
You can modify the request’s properties prior to calling resume on the task. The task uses these properties during the HTTP handshake phase.
To add custom protocols, add a header with the key Sec-WebSocket-Protocol, and a comma-separated list of protocols you want to negotiate with the server. The custom HTTP headers provided by the client remain unchanged for the handshake with the server.
NSURLSessionMBS.webSocketTaskWithURL(URL as String) as NSURLSessionWebSocketTaskMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
url: The WebSocket URL with which to connect.
The provided URL must have a ws or wss scheme.
See also:
NSURLSessionMBS.webSocketTaskWithURL(URL as String, Protocols() as String) as NSURLSessionWebSocketTaskMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
url: The WebSocket URL with which to connect.
protocols: An array of protocols to negotiate with the server.
During the WebSocket handshake, the task uses the provided protocols to negotiate a preferred protocol with the server.
The protocol doesn’t affect the WebSocket framing. More details on the protocol are available in RFC 6455, The WebSocket Protocol.
See also:
The items on this page are in the following plugins: MBS MacFrameworks Plugin.