|Type||Topic||Plugin||Version||macOS||Windows||Linux||Console & Web||iOS|
|class||HTMLViewer Mac||MBS MacControls Plugin||11.3||Yes||No||No||Yes, macOS only||No|
The NSURLDownloadDelegate protocol defines methods that allow an object to receive informational callbacks about the asynchronous load of a download's URL request. Other delegate methods provide facilities that allow the delegate to customize the process of performing an asynchronous URL load.
Note that these delegate methods will be called on the thread that started the asynchronous load operation for the associated NSURLDownload object.
- A didBegin message will be sent to the delegate immediately upon starting the download.
- Zero or more willSendRequest messages will be sent to the delegate before any further messages are sent if it is determined that the download must redirect to a new location. The delegate can allow the redirect, modify the destination or deny the redirect.
- Zero or more didReceiveAuthenticationChallenge messages will be sent to the delegate if it is necessary to authenticate in order to download the request and NSURLDownload does not already have authenticated credentials.
- Zero or more didCancelAuthenticationChallenge messages will be sent to the delegate if NSURLDownload cancels the authentication challenge due to encountering a protocol implementation error.
- Zero or more didReceiveResponse messages will be sent to the delegate before receiving a didReceiveDataOfLength message. The only case where didReceiveResponse is not sent to a delegate is when the protocol implementation encounters an error before a response could be created.
- Zero or more didReceiveDataOfLength messages will be sent before didFinish or didFailWithError is sent to the delegate.
- Zero or one decideDestinationWithSuggestedFilename will be sent to the delegate when sufficient information has been received to determine the suggested filename for the downloaded file. The delegate will not receive this message if setDestination has already been sent to the NSURLDownload instance.
- A didCreateDestination message will be sent to the delegate when the NSURLDownload instance creates the file on disk.
- If NSURLDownload determines that the downloaded file is in a format that it is able to decode (MacBinary, Binhex or gzip), the delegate will receive a shouldDecodeSourceDataOfMIMEType. The delegate should return true to decode the data, false otherwise.
- Unless an NSURLDownload instance receives a cancel message, the delegate will receive one and only one didFinish or didFailWithError: message, but never both. In addition, once either of messages are sent, the delegate will receive no further messages for the given NSURLDownload.
Please use one delegate class per HTMLViewer (or WebViewMBS) and make sure they live about the same time. Our class keeps a reference on the WebView, so we can remove our delegate when the delegate is destroyed.
- 17 events
- event canAuthenticateAgainstProtectionSpace(download as NSURLDownloadMBS, protectionSpace as NSURLProtectionSpaceMBS) as boolean
- event Close
- event decideDestinationWithSuggestedFilename(download as NSURLDownloadMBS, filename as string)
- event DidBegin(download as NSURLDownloadMBS)
- event didCancelAuthenticationChallenge(download as NSURLDownloadMBS, challenge as NSURLAuthenticationChallengeMBS)
- event didCreateDestination(download as NSURLDownloadMBS, path as string, file as folderitem)
- event didFailWithError(download as NSURLDownloadMBS, error as NSErrorMBS)
- event DidFinish(download as NSURLDownloadMBS)
- event didReceiveAuthenticationChallenge(download as NSURLDownloadMBS, challenge as NSURLAuthenticationChallengeMBS)
- event didReceiveDataOfLength(download as NSURLDownloadMBS, length as UInt64)
- event didReceiveResponse(download as NSURLDownloadMBS, response as NSURLResponseMBS)
- event Open
- event shouldDecodeSourceDataOfMIMEType(download as NSURLDownloadMBS, encodingType as string) as boolean
- event ShouldUseCredentialStorage(download as NSURLDownloadMBS) as boolean
- event willResumeWithResponse(download as NSURLDownloadMBS, response as NSURLResponseMBS, startingByte as Int64)
- event willSendRequest(download as NSURLDownloadMBS, request as NSURLRequestMBS, redirectResponse as NSURLResponseMBS) as NSURLRequestMBS
- event WindowForAuthenticationSheet(download as NSURLDownloadMBS) as NSWindowMBS
This class has no sub classes.
Some useful global functions for this class:
Some methods using this class:
- HTMLViewer.InstallWebDownloadDelegateMBS(WebDownloadDelegate as WebDownloadDelegateMBS)
Some examples which use this class:
The items on this page are in the following plugins: MBS MacControls Plugin.
MBS Xojo Chart Plugins