Super class: NSURLSessionTaskMBS
|class||Cocoa Networking||MBS MacFrameworks Plugin||20.2||✅ Yes||❌ No||❌ No||✅ Yes||All|
An NSURLSessionDownloadTaskMBS is a concrete subclass of NSURLSessionTask. Most of the methods associated with this class are documented in NSURLSessionTaskMBS.
Download tasks directly write the server’s response data to a temporary file, providing your app with progress updates as data arrives from the server. When you use download tasks in background sessions, these downloads continue even when your app is suspended or is otherwise not running.
You can pause (cancel) download tasks and resume them later (assuming the server supports doing so). You can also resume downloads that failed because of network connectivity problems.
When you use a download task, your NSURLSessionMBS subclass receives several callbacks unique to download scenarios.
- During download, the session periodically calls the downloadTaskDidWriteData event with status information.
- Upon successful completion, the session calls the downloadTaskDidFinishDownloadingToURL event or completion handler. In that method, you must either open the file for reading or move it to a permanent location in your app’s sandbox container directory.
- Upon unsuccessful completion, the session calls the taskDidCompleteWithError method or completion handler. Unlike NSURLSessionDataTaskMBS or NSURLSessionUploadTaskMBS, a download task reports server-side errors reported through HTTP status codes into corresponding NSError objects.
This is an abstract class. You can't create an instance, but you can get one from various plugin functions.
- 2 methods
- shared method NSURLSessionDownloadTaskResumeData as string
- delegate ProducingResumeDataCompletedMBS(downloadTask as NSURLSessionDownloadTaskMBS, resumeData as MemoryBlock, tag as variant)
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
- 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.
This class has no sub classes.
Some methods using this class:
- NSURLSessionMBS.downloadTaskWithRequest(request as NSURLRequestMBS) as NSURLSessionDownloadTaskMBS
- NSURLSessionMBS.downloadTaskWithResumeData(resumeData as MemoryBlock) as NSURLSessionDownloadTaskMBS
- NSURLSessionMBS.downloadTaskWithURL(URL as String) as NSURLSessionDownloadTaskMBS
Some events using this class:
- NSURLSessionMBS.dataTaskDidBecomeDownloadTask(dataTask as NSURLSessionDataTaskMBS, downloadTask as NSURLSessionDownloadTaskMBS)
- NSURLSessionMBS.downloadTaskDidFinishDownloadingToURL(downloadTask as NSURLSessionDownloadTaskMBS, location as String, file as FolderItem)
- NSURLSessionMBS.downloadTaskDidResumeAtOffset(downloadTask as NSURLSessionDownloadTaskMBS, fileOffset as Int64, expectedTotalBytes as Int64)
- NSURLSessionMBS.downloadTaskDidWriteData(downloadTask as NSURLSessionDownloadTaskMBS, bytesWritten as Int64, totalBytesWritten as Int64, totalBytesExpectedToWrite as Int64)
Some examples using this class:
The items on this page are in the following plugins: MBS MacFrameworks Plugin.
MBS Xojo Chart Plugins