Platforms to show: All Mac Windows Linux Cross-Platform
NSURLSessionMBS class
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Read more on Apple's website:
https://developer.apple.com/documentation/foundation/nsurlsession
MBS Plugin implements all delegates within NSURLSessionMBS class, so you can subclass it and fill events.
- 21 events
- event dataTaskDidBecomeDownloadTask(dataTask as NSURLSessionDataTaskMBS, downloadTask as NSURLSessionDownloadTaskMBS)
- event dataTaskDidBecomeStreamTask(dataTask as NSURLSessionDataTaskMBS, downloadTask as NSURLSessionStreamTaskMBS)
- event dataTaskDidReceiveData(dataTask as NSURLSessionDataTaskMBS, data as MemoryBlock)
- event dataTaskDidReceiveResponse(dataTask as NSURLSessionDataTaskMBS, response as NSURLResponseMBS) as Integer
- event dataTaskWillCacheResponse(dataTask as NSURLSessionDataTaskMBS, proposedResponse as NSCachedURLResponseMBS) as NSCachedURLResponseMBS
- event didBecomeInvalid(error as NSErrorMBS)
- event didReceiveChallenge(challenge as NSURLAuthenticationChallengeMBS, byref disposition as Integer, byref credential as NSURLCredentialMBS)
- event downloadTaskDidFinishDownloadingToURL(downloadTask as NSURLSessionDownloadTaskMBS, location as String, file as FolderItem)
- event downloadTaskDidResumeAtOffset(downloadTask as NSURLSessionDownloadTaskMBS, fileOffset as Int64, expectedTotalBytes as Int64)
- event downloadTaskDidWriteData(downloadTask as NSURLSessionDownloadTaskMBS, bytesWritten as Int64, totalBytesWritten as Int64, totalBytesExpectedToWrite as Int64)
- event streamTaskBetterRouteDiscoveredForStreamTask(streamTask as NSURLSessionStreamTaskMBS)
- event streamTaskDidBecomeInputStream(streamTask as NSURLSessionStreamTaskMBS, inputStream as NSInputStreamMBS, outputStream as NSOutputStreamMBS)
- event streamTaskReadClosedForStreamTask(streamTask as NSURLSessionStreamTaskMBS)
- event streamTaskWriteClosedForStreamTask(streamTask as NSURLSessionStreamTaskMBS)
- event taskDidCompleteWithError(task as NSURLSessionTaskMBS, error as NSErrorMBS)
- event taskDidFinishCollectingMetrics(task as NSURLSessionTaskMBS, metrics as NSURLSessionTaskMetricsMBS)
- event taskDidSendBodyData(task as NSURLSessionTaskMBS, bytesSent as Int64, totalBytesSent as Int64, totalBytesExpectedToSend as Integer)
- event taskIsWaitingForConnectivity(task as NSURLSessionTaskMBS)
- event taskWillPerformHTTPRedirection(task as NSURLSessionTaskMBS, response as NSURLResponseMBS, request as NSURLRequestMBS) as NSURLRequestMBS
- event webSocketTaskDidCloseWithCode(webSocketTask as NSURLSessionWebSocketTaskMBS, closeCode as Integer, reason as MemoryBlock)
- event webSocketTaskDidOpenWithProtocol(webSocketTask as NSURLSessionWebSocketTaskMBS, protocol as String)
- 3 properties
- property configuration as NSURLSessionConfigurationMBS
- property Handle as Integer
- property sessionDescription as String
- 27 methods
- method Constructor
- method Constructor(configuration as NSURLSessionConfigurationMBS)
- method dataTaskWithRequest(request as NSURLRequestMBS) as NSURLSessionDataTaskMBS
- method dataTaskWithRequest(request as NSURLRequestMBS, handler as NSURLSessionDataTaskCompletedMBS, tag as Variant = nil) as NSURLSessionDataTaskMBS
- method dataTaskWithURL(URL as String) as NSURLSessionDataTaskMBS
- method dataTaskWithURL(URL as String, handler as NSURLSessionDataTaskCompletedMBS, tag as Variant = nil) as NSURLSessionDataTaskMBS
- method downloadTaskWithRequest(request as NSURLRequestMBS) as NSURLSessionDownloadTaskMBS
- method downloadTaskWithRequest(request as NSURLRequestMBS, handler as NSURLSessionUploadTaskCompletedMBS, tag as Variant = nil) as NSURLSessionDataTaskMBS
- method downloadTaskWithResumeData(resumeData as MemoryBlock) as NSURLSessionDownloadTaskMBS
- method downloadTaskWithResumeData(resumeData as MemoryBlock, handler as NSURLSessionUploadTaskCompletedMBS, tag as Variant = nil) as NSURLSessionDataTaskMBS
- method downloadTaskWithURL(URL as String) as NSURLSessionDownloadTaskMBS
- method downloadTaskWithURL(URL as String, handler as NSURLSessionUploadTaskCompletedMBS, tag as Variant = nil) as NSURLSessionDataTaskMBS
- method finishTasksAndInvalidate
- method flush(Handler as NSURLSessionFlushCompletedMBS = nil, tag as variant = nil)
- method invalidateAndCancel
- method reset(Handler as NSURLSessionResetCompletedMBS = nil, tag as variant = nil)
- method streamTaskWithHostName(hostname as String, Port as Integer) as NSURLSessionStreamTaskMBS
- method Tasks as NSURLSessionTaskMBS()
- method Tasks(Handler as NSURLSessionTasksCompletedMBS, tag as variant = nil)
- method uploadTaskWithRequest(request as NSURLRequestMBS, data as MemoryBlock) as NSURLSessionUploadTaskMBS
- method uploadTaskWithRequest(request as NSURLRequestMBS, data as MemoryBlock, handler as NSURLSessionUploadTaskCompletedMBS, tag as Variant = nil) as NSURLSessionDataTaskMBS
- method uploadTaskWithRequest(request as NSURLRequestMBS, file as folderItem) as NSURLSessionUploadTaskMBS
- method uploadTaskWithRequest(request as NSURLRequestMBS, file as FolderItem, handler as NSURLSessionUploadTaskCompletedMBS, tag as Variant = nil) as NSURLSessionDataTaskMBS
- method uploadTaskWithStreamedRequest(request as NSURLRequestMBS) as NSURLSessionUploadTaskMBS
- method webSocketTaskWithRequest(request as NSURLRequestMBS) as NSURLSessionWebSocketTaskMBS
- method webSocketTaskWithURL(URL as String) as NSURLSessionWebSocketTaskMBS
- method webSocketTaskWithURL(URL as String, Protocols() as String) as NSURLSessionWebSocketTaskMBS
- 2 shared methods
- shared method available as Boolean
- shared method sharedSession as NSURLSessionMBS
- 7 delegates
- delegate NSURLSessionAllTasksCompletedMBS(tasks() as NSURLSessionTaskMBS, tag as variant)
- delegate NSURLSessionDataTaskCompletedMBS(data as MemoryBlock, response as NSURLResponseMBS, error as NSErrorMBS, tag as variant)
- delegate NSURLSessionDownloadTaskCompletedMBS(location as String, file as FolderItem, response as NSURLResponseMBS, error as NSErrorMBS, tag as variant)
- delegate NSURLSessionFlushCompletedMBS(tag as variant)
- delegate NSURLSessionResetCompletedMBS(tag as variant)
- delegate NSURLSessionTasksCompletedMBS(dataTasks() as NSURLSessionDataTaskMBS, uploadTasks() as NSURLSessionUploadTaskMBS, downloadTasks() as NSURLSessionDownloadTaskMBS, tag as variant)
- delegate NSURLSessionUploadTaskCompletedMBS(data as MemoryBlock, response as NSURLResponseMBS, error as NSErrorMBS, tag as variant)
- 11 constants
Auth Challenge Disposition Modes
Constant | Value | Description |
---|---|---|
AuthChallengeCancelAuthenticationChallenge | 2 |
The entire request will be canceled; the credential parameter is ignored. |
AuthChallengePerformDefaultHandling | 1 |
Default handling for the challenge - as if this delegate were not implemented; the credential parameter is ignored. |
AuthChallengeRejectProtectionSpace | 3 |
This challenge is rejected and the next authentication protection space should be tried; the credential parameter is ignored. |
AuthChallengeUseCredential | 0 |
Use the specified credential, which may be nil |
Delayed Request Disposition
Constant | Value | Description |
---|---|---|
DelayedRequestCancel | 2 |
Cancel the task; the request parameter is ignored. |
DelayedRequestContinueLoading | 0 |
Use the original request provided when the task was created; the request parameter is ignored. |
DelayedRequestUseNewRequest | 1 |
Use the specified request, which may not be nil. |
Response Disposition
Constant | Value | Description |
---|---|---|
ResponseAllow | 1 |
Allow the load operation to continue. |
ResponseBecomeDownload | 2 |
Convert the response for this request to use a NSURLSessionDownloadTaskMBS. |
ResponseBecomeStream | 3 |
Convert the response for this request to use a NSURLSessionStreamTaskMBS. |
ResponseCancel | 0 |
Cancel the load. |
This class has no sub classes.
Some examples using this class:
Blog Entries
- MBS Xojo Plugins, version 22.3pr1
- NSNetService classes for Xojo
- Three new controls for iOS in Xojo
- MBS Xojo Plugins, version 20.3pr10
- New in the MBS Xojo Plugins Version 20.2
- MonkeyBread Software Releases the MBS Xojo Plugins in version 20.2
- Adding NSURLSession classes for Xojo
- MBS Xojo Plugins, version 20.2pr3
Release notes
- Version 22.3
- Fixed problem with Reset method in NSURLSessionMBS crashing if no handler is passed.
- Version 20.3
- Changed NSURLSessionMBS classes to only load on Xojo 2015 or newer.
- Version 20.2
- Added NSURLSessionMBS and related classes to support HTTP/2 in Xojo on MacOS.
- Deprecated NSURLConnectionMBS in favor of NSURLSessionMBS class.
The items on this page are in the following plugins: MBS MacFrameworks Plugin.
NSURLSessionDownloadTaskMBS - NSURLSessionStreamTaskMBS