Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSURLDownloadMBS class.

NSURLDownloadMBS.canAuthenticateAgainstProtectionSpace(protectionSpace as NSURLProtectionSpaceMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Cocoa Networking MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ❌ No
Sent to determine whether the delegate is able to respond to a protection space's form of authentication. (required)

protectionSpace: The protection space that generates an authentication challenge.

This method is called before didReceiveAuthenticationChallenge, allowing the delegate to inspect a protection space before attempting to authenticate against it. By returning true, the delegate indicates that it can handle the form of authentication, which it does in the subsequent call to didReceiveAuthenticationChallenge. Not implementing this method is the same as returning false, in which case default authentication handling is used.

Available in Mac OS X v10.6 and later.

NSURLDownloadMBS.decideDestinationWithSuggestedFilename(filename as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Cocoa Networking MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ❌ No
The delegate receives this message when download has determined a suggested filename for the downloaded file. (required)

filename: The suggested filename for the download.

The suggested filename is either derived from the last path component of the URL and the MIME type or, if the download was encoded, from the encoding. If the delegate wishes to modify the path, it should send setDestination to download.

The delegate will not receive this message if setDestination has already been called for the download.

Available in Mac OS X v10.2 and later.

Some examples using this event:

NSURLDownloadMBS.DidBegin

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Cocoa Networking MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ❌ No
Sent immediately after a download object begins a download. (required)

Available in Mac OS X v10.2 and later.

Some examples using this event:

NSURLDownloadMBS.didCancelAuthenticationChallenge(challenge as NSURLAuthenticationChallengeMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Cocoa Networking MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ❌ No
Sent if an authentication challenge is canceled due to the protocol implementation encountering an error. (required)

challenge: The authentication challenge that caused the download object to cancel the download.

If the delegate receives this message the download will fail and the delegate will receive a didFailWithError message.

Available in Mac OS X v10.2 and later.

NSURLDownloadMBS.didCreateDestination(path as string, file as folderitem)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Cocoa Networking MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ❌ No
Sent when the destination file is created. (required)

path: The path to the destination file.
file: The path to the destination file as folderitem.

Available in Mac OS X v10.2 and later.

Some examples using this event:

NSURLDownloadMBS.didFailWithError(error as NSErrorMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Cocoa Networking MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ❌ No
Sent if the download fails or if an I/O error occurs when the file is written to disk. (required)

error: The error that caused the failure of the download.

Any partially downloaded file will be deleted.

Once the delegate receives this message, it will receive no further messages for download.
Available in Mac OS X v10.2 and later.

NSURLDownloadMBS.DidFinish

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Cocoa Networking MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ❌ No
Sent when a download object has completed downloading successfully and has written its results to disk. (required)

The delegate will receive no further messages for download.
Available in Mac OS X v10.2 and later.

NSURLDownloadMBS.didReceiveAuthenticationChallenge(challenge as NSURLAuthenticationChallengeMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Cocoa Networking MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ❌ No
Sent when the URL download must authenticate a challenge in order to download the request. (required)

challenge: The URL authentication challenge that must be authenticated in order to download the request.

This method gives the delegate the opportunity to determine the course of action taken for the challenge: provide credentials, continue without providing credentials or cancel the authentication challenge and the download.

The delegate can determine the number of previous authentication challenges by sending the message previousFailureCount to challenge.

If the previous failure count is 0 and the value returned by proposedCredential is nil, the delegate can create a new NSURLCredential object, providing information specific to the type of credential, and send a useCredential message to challenge, passing the credential and challenge as parameters. If proposedCredential is not nil, the value is a credential from the URL or the shared credential storage that can be provided to the user as feedback.

The delegate may decide to abandon further attempts at authentication at any time by sending challenge a continueWithoutCredentialForAuthenticationChallenge or a cancelAuthenticationChallenge message. The specific action is implementation dependent.

If the delegate implements this method, the download will suspend until [challenge sender] is sent one of the following messages: useCredential, continueWithoutCredentialForAuthenticationChallenge or cancelAuthenticationChallenge.

If the delegate does not implement this method the default implementation is used. If a valid credential for the request is provided as part of the URL, or is available from the NSURLCredentialStorage the challenge is sent a useCredential:forAuthenticationChallenge with the credential. If the challenge has no credential or the credentials fail to authorize access, then continueWithoutCredentialForAuthenticationChallenge is sent to challenge sender instead.

Available in Mac OS X v10.2 and later.

NSURLDownloadMBS.didReceiveDataOfLength(length as UInt64)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Cocoa Networking MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ❌ No
Sent as a download object receives data incrementally. (required)

length: The amount of data received in this increment of the download, measured in bytes.

Available in Mac OS X v10.2 and later.

Some examples using this event:

NSURLDownloadMBS.didReceiveResponse(response as NSURLResponseMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Cocoa Networking MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ❌ No
Sent when a download object has received sufficient load data to construct the NSURLResponse object for the download. (required)

response: The URL response object received as part of the download. response is immutable and will not be modified after this method is called.

In some rare cases, multiple responses may be received for a single download. In this case, the client should assume that each new response resets the download progress to 0 and should check the new response for the expected content length.
Available in Mac OS X v10.2 and later.

NSURLDownloadMBS.shouldDecodeSourceDataOfMIMEType(encodingType as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Cocoa Networking MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ❌ No
Sent when a download object determines that the downloaded file is encoded to inquire whether the file should be automatically decoded. (required)

encodingType: The type of encoding used by the downloaded file. The supported encoding formats are MacBinary ("application/macbinary"), Binhex ("application/mac-binhex40") and gzip ("application/gzip").

Return true to decode the file, false otherwise.

The delegate may receive this message more than once if the file has been encoded multiple times. This method is not called if the downloaded file is not encoded.
Available in Mac OS X v10.2 and later.

Some examples using this event:

NSURLDownloadMBS.shouldUseCredentialStorage as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Cocoa Networking MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ❌ No
Sent to determine whether the URL loader should consult the credential storage to authenticate the download. (required)

This method is called before any attempt to authenticate is made. By returning false, the delegate tells the download not to consult the credential storage and makes itself responsible for providing credentials for any authentication challenges. Not implementing this method is the same as returing true. The delegate is free to consult the credential storage itself when it receives a didReceiveAuthenticationChallenge message.

Available in Mac OS X v10.6 and later.

NSURLDownloadMBS.willResumeWithResponse(response as NSURLResponseMBS, startingByte as Int64)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Cocoa Networking MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ❌ No
Sent when a download object has received a response from the server after attempting to resume a download. (required)

response: The URL response received from the server in response to an attempt to resume a download.

The location of the start of the resumed data, in bytes.
Available in Mac OS X v10.4 and later.

Some examples using this event:

NSURLDownloadMBS.willSendRequest(request as NSURLRequestMBS, redirectResponse as NSURLResponseMBS) as NSURLRequestMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Cocoa Networking MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ❌ No
Sent when the download object determines that it must change URLs in order to continue loading a request. (required)

request: The proposed redirected request. The delegate should inspect the redirected request to verify that it meets its needs, and create a copy with new attributes to return to the connection if necessary.
redirectResponse: The URL response that caused the redirect. May be nil in cases where this method is not being sent as a result of involving the delegate in redirect processing.

Return the actual URL request to use in light of the redirection response. The delegate may copy and modify request as necessary to change its attributes, return request unmodified, or return nil.

If the delegate wishes to cancel the redirect, it should call the download object's cancel method. Alternatively, the delegate method can return nil to cancel the redirect, and the download will continue to process. This has special relevance in the case where redirectResponse is not nil. In this case, any data that is loaded for the download will be sent to the delegate, and the delegate will receive a downloadDidFinish: or download:didFailWithError: message, as appropriate.

The delegate can receive this message as a result of transforming a request's URL to its canonical form, or for protocol-specific reasons, such as an HTTP redirect. The delegate implementation should be prepared to receive this message multiple times.

Available in Mac OS X v10.2 and later.

The items on this page are in the following plugins: MBS MacBase Plugin.


The biggest plugin in space...