Protocol

NSURLConnection​Delegate

The NSURLConnection​Delegate protocol defines methods common to the NSURLConnection​Data​Delegate and NSURLConnection​Download​Delegate protocols.

Overview

Delegates of NSURLConnection objects should implement either the data or download delegate protocol (including the methods described in this protocol). Specifically:

  • If you are using NSURLConnection in conjunction with Newsstand Kit’s download(with:​) method, the delegate class should implement the NSURLConnection​Download​Delegate protocol.

  • Otherwise, the delegate class should implement the NSURLConnection​Data​Delegate protocol.

Delegates that wish to perform custom authentication handling should implement the connection(_:​will​Send​Request​For:​) method, which is the preferred mechanism for responding to authentication challenges. (See URLAuthentication​Challenge for more information on authentication challenges.) If connection(_:​will​Send​Request​For:​) is not implemented, the older, deprecated methods connection(_:​can​Authenticate​Against​Protection​Space:​), connection(_:​did​Receive:​), and connection(_:​did​Cancel:​) are called instead.

The connection(_:​did​Fail​With​Error:​) method is called at most once if an error occurs during the loading of a resource. The connection​Should​Use​Credential​Storage(_:​) method is called once, just before the loading of a resource begins.

Symbols

Connection Authentication

func connection(NSURLConnection, will​Send​Request​For:​ URLAuthentication​Challenge)

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

func connection(NSURLConnection, can​Authenticate​Against​Protection​Space:​ URLProtection​Space)

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

Deprecated
func connection(NSURLConnection, did​Cancel:​ URLAuthentication​Challenge)

Sent when a connection cancels an authentication challenge.

Deprecated
func connection(NSURLConnection, did​Receive:​ URLAuthentication​Challenge)

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

Deprecated
func connection​Should​Use​Credential​Storage(NSURLConnection)

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

Connection Completion

func connection(NSURLConnection, did​Fail​With​Error:​ Error)

Sent when a connection fails to load its request successfully.

Relationships

Inherits From