Protocol

NSURLConnectionDelegate

A protocol that delegates of a URL connection implement to receive status about and provide feedback to the connection object.

Declaration

@protocol NSURLConnectionDelegate

Overview

Delegates of NSURLConnection objects should implement either the NSURLConnectionDataDelegate or NSURLConnectionDownloadDelegate protocol in addition to the NSURLConnectionDelegate protocol. Specifically:

Delegates that wish to perform custom authentication handling should implement the connection:willSendRequestForAuthenticationChallenge: method, which is the preferred mechanism for responding to authentication challenges. (See NSURLAuthenticationChallenge for more information on authentication challenges.) If connection:willSendRequestForAuthenticationChallenge: is not implemented, the older, deprecated methods connection:canAuthenticateAgainstProtectionSpace:, connection:didReceiveAuthenticationChallenge:, and connection:didCancelAuthenticationChallenge: are called instead.

The connection:didFailWithError: method is called at most once if an error occurs during the loading of a resource. The connectionShouldUseCredentialStorage: method is called once, just before the loading of a resource begins.

Topics

Connection Authentication

- connection:willSendRequestForAuthenticationChallenge:

Tells the delegate that the connection will send a request for an authentication challenge.

- connection:canAuthenticateAgainstProtectionSpace:

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

Deprecated
- connection:didCancelAuthenticationChallenge:

Sent when a connection cancels an authentication challenge.

Deprecated
- connection:didReceiveAuthenticationChallenge:

Sent when a connection must authenticate a challenge in order to download its request.

Deprecated
- connectionShouldUseCredentialStorage:

Sent to determine whether the URL loader should use the credential storage for authenticating the connection.

Connection Completion

- connection:didFailWithError:

Sent when a connection fails to load its request successfully.

See Also

URL Connection

NSURLConnection

An object that enables you to start and stop URL requests.

NSURLConnectionDataDelegate

A protocol that most delegates of a URL connection implement to receive data associated with the connection.

NSURLConnectionDownloadDelegate

A protocol that delegates of a URL connection created with Newsstand Kit implement to receive data associated with a download.