Instance Method

webView:didReceiveAuthenticationChallenge:completionHandler:

Called when the web view needs to respond to an authentication challenge.

Declaration

- (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler;

Parameters

webView

The web view receiving the authentication challenge.

challenge

The authentication challenge.

completionHandler

A block to invoke to respond to the challenge. The disposition parameter must be one of the constants of the enumerated type NSURLSessionAuthChallengeDisposition. When disposition is NSURLSessionAuthChallengeUseCredential, the credential parameter specifies the credential to use, or nil to continue without a credential.

Discussion

If you do not implement this method, the web view will respond to the authentication challenge with the NSURLSessionAuthChallengeRejectProtectionSpace disposition.