Sent when a connection must authenticate a challenge in order to download its request.
- iOS 2.0–8.0Deprecated
- macOS 10.2–10.10Deprecated
- tvOS 9.0–9.0Deprecated
- watchOS 2.0–2.0Deprecated
The connection sending the message.
The challenge that
connectionmust authenticate in order to download its 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
If the previous failure count is 0 and the value returned by
nil, the delegate can create a new NSURLCredential object, providing information specific to the type of credential, and send a
use(_: message to
[challenge sender], passing the credential and
challenge as parameters. If
proposed 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 sender] a
continue or a
cancel(_:) message. The specific action is implementation dependent.
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 sender] is sent a
use(_: with the credential. If the challenge has no credential or the credentials fail to authorize access, then
continue is sent to
[challenge sender] instead.