Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when the webview evaluete javascript fail will cause crash #183

Closed
zhipcui opened this issue Jan 29, 2016 · 1 comment
Closed

when the webview evaluete javascript fail will cause crash #183

zhipcui opened this issue Jan 29, 2016 · 1 comment

Comments

@zhipcui
Copy link

zhipcui commented Jan 29, 2016

  • (void)WKFlushMessageQueue {
    [_webView evaluateJavaScript:[_base webViewJavascriptFetchQueyCommand] completionHandler:^(NSString* result, NSError* error) {
    [_base flushMessageQueue:result];
    }];
    }

The reason:
if the result == nil, then flushMessageQueue try to _deserializeMessageJSON a nill object.

marcuswestin added a commit that referenced this issue Jan 29, 2016
…s from the javascript, instead of throwing an exception while attempting to decode the message as JSON.

This can occur e.g if the webview loaded a new page immediately after dispatching a message to ObjC, in which case WebViewJavascriptBridge may not exist in the JS by the time ObjC reaches in to fetch the message queue.

Fix #159, #183
@marcuswestin
Copy link
Owner

Fixed in v5.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants