A protocol that URL download delegates implement to interact with a URL download request.


@protocol NSURLDownloadDelegate


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.


Download Authentication

- download:canAuthenticateAgainstProtectionSpace:

Sent to determine whether the delegate is able to respond to a protection space’s form of authentication.

- download:didCancelAuthenticationChallenge:

Sent if an authentication challenge is canceled due to the protocol implementation encountering an error.

- download:didReceiveAuthenticationChallenge:

Sent when the URL download must authenticate a challenge in order to download the request.

- downloadShouldUseCredentialStorage:

Sent to determine whether the URL loader should consult the credential storage to authenticate the download.

Download Data and Responses

- download:decideDestinationWithSuggestedFilename:

The delegate receives this message when download has determined a suggested filename for the downloaded file.

- downloadDidBegin:

Sent immediately after a download object begins a download.

- download:didCreateDestination:

Sent when the destination file is created.

- download:didReceiveResponse:

Sent when a download object has received sufficient load data to construct the NSURLResponse object for the download.

- download:didReceiveDataOfLength:

Sent as a download object receives data incrementally.

- download:shouldDecodeSourceDataOfMIMEType:

Sent when a download object determines that the downloaded file is encoded to inquire whether the file should be automatically decoded.

- download:willResumeWithResponse:fromByte:

Sent when a download object has received a response from the server after attempting to resume a download.

- download:willSendRequest:redirectResponse:

Sent when the download object determines that it must change URLs in order to continue loading a request.

Download Completion

- download:didFailWithError:

Sent if the download fails or if an I/O error occurs when the file is written to disk.

- downloadDidFinish:

Sent when a download object has completed downloading successfully and has written its results to disk.


Inherits From

See Also

URL Download


An object that downloads a resource asynchronously and saves the data to a file.