Skip to content

Commit 7952c49

Browse files
authored
Merge pull request marcuswestin#207 from eJamesLin/AddMissingWKNavigationDelegate_Authentication
Add WKNavigationDelegate AuthenticationChallenge support
2 parents fc8f011 + 66626b0 commit 7952c49

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

WebViewJavascriptBridge/WKWebViewJavascriptBridge.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,15 @@ - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigat
102102
}
103103
}
104104

105+
- (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential *))completionHandler
106+
{
107+
if (webView != _webView) { return; }
108+
109+
__strong typeof(_webViewDelegate) strongDelegate = _webViewDelegate;
110+
if (strongDelegate && [strongDelegate respondsToSelector:@selector(webView:didReceiveAuthenticationChallenge:completionHandler:)]) {
111+
[strongDelegate webView:webView didReceiveAuthenticationChallenge:challenge completionHandler:completionHandler];
112+
}
113+
}
105114

106115
- (void)webView:(WKWebView *)webView
107116
decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction

0 commit comments

Comments
 (0)