Skip to content

Commit 5f10f81

Browse files
committed
Use explicit WVJB_WEBVIEW_DELEGATE_TYPE instead of inferred typeof(_webViewDelegate). Should hopefully fix GH issues marcuswestin#81 and marcuswestin#98
1 parent dcecc11 commit 5f10f81

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Changelog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Version History
1515

1616
Intended v5.0.0
1717
+ Removed `WebViewJavascriptBridge -reset`. It should never have been exposed as a public API.
18+
+ Fixed compilation in C99 mode
1819

1920
v4.1.4
2021
+ Improve how WVJB handles the case when there is no ObjC handler for a message received from js.

WebViewJavascriptBridge/WebViewJavascriptBridge.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ - (void)webViewDidFinishLoad:(UIWebView *)webView {
356356
_startupMessageQueue = nil;
357357
}
358358

359-
__strong typeof(_webViewDelegate) strongDelegate = _webViewDelegate;
359+
__strong WVJB_WEBVIEW_DELEGATE_TYPE* strongDelegate = _webViewDelegate;
360360
if (strongDelegate && [strongDelegate respondsToSelector:@selector(webViewDidFinishLoad:)]) {
361361
[strongDelegate webViewDidFinishLoad:webView];
362362
}
@@ -367,7 +367,7 @@ - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
367367

368368
_numRequestsLoading--;
369369

370-
__strong typeof(_webViewDelegate) strongDelegate = _webViewDelegate;
370+
__strong WVJB_WEBVIEW_DELEGATE_TYPE* strongDelegate = _webViewDelegate;
371371
if (strongDelegate && [strongDelegate respondsToSelector:@selector(webView:didFailLoadWithError:)]) {
372372
[strongDelegate webView:webView didFailLoadWithError:error];
373373
}
@@ -376,7 +376,7 @@ - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
376376
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
377377
if (webView != _webView) { return YES; }
378378
NSURL *url = [request URL];
379-
__strong typeof(_webViewDelegate) strongDelegate = _webViewDelegate;
379+
__strong WVJB_WEBVIEW_DELEGATE_TYPE* strongDelegate = _webViewDelegate;
380380
if ([[url scheme] isEqualToString:kCustomProtocolScheme]) {
381381
if ([[url host] isEqualToString:kQueueHasMessage]) {
382382
[self _flushMessageQueue];
@@ -396,7 +396,7 @@ - (void)webViewDidStartLoad:(UIWebView *)webView {
396396

397397
_numRequestsLoading++;
398398

399-
__strong typeof(_webViewDelegate) strongDelegate = _webViewDelegate;
399+
__strong WVJB_WEBVIEW_DELEGATE_TYPE* strongDelegate = _webViewDelegate;
400400
if (strongDelegate && [strongDelegate respondsToSelector:@selector(webViewDidStartLoad:)]) {
401401
[strongDelegate webViewDidStartLoad:webView];
402402
}

0 commit comments

Comments
 (0)