Skip to content

Commit 7207111

Browse files
committed
Merge pull request marcuswestin#170 from kingiol/master
add support for internet offline fail call
2 parents 64f5c9a + 3fc36df commit 7207111

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

WebViewJavascriptBridge/WKWebViewJavascriptBridge.m

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,17 @@ - (void)webView:(WKWebView *)webView
151151
}
152152
}
153153

154+
- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error {
155+
if (webView != _webView) { return; }
156+
157+
_base.numRequestsLoading--;
158+
159+
__strong typeof(_webViewDelegate) strongDelegate = _webViewDelegate;
160+
if (strongDelegate && [strongDelegate respondsToSelector:@selector(webView:didFailProvisionalNavigation:withError:)]) {
161+
[strongDelegate webView:webView didFailProvisionalNavigation:navigation withError:error];
162+
}
163+
}
164+
154165
- (NSString*) _evaluateJavascript:(NSString*)javascriptCommand
155166
{
156167
[_webView evaluateJavaScript:javascriptCommand completionHandler:nil];

0 commit comments

Comments
 (0)