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

Fix: complete handler must be call before wkwebview dealloc. If not c… #104

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

gdxz123
Copy link

@gdxz123 gdxz123 commented Sep 17, 2019

…alled, webview will be crash. When H5 alert( comfirm/ promot) something, and webview dealloc, then the dwkwebview will crash.

…alled, webview will be crash. When H5 alert( comfirm/ promot) something, and webview dealloc, then the dwkwebview will crash.
@gdxz123
Copy link
Author

gdxz123 commented Sep 17, 2019

bugly crash report:

#0 Thread
NSInternalInconsistencyException
Completion handler passed to -[DWKWebView webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:] was not called

@qianshou
Copy link

赞,这样即使销毁后弹窗也不会导致crash了。不过还是会出现webview已经关闭,仍然弹出alert框的情况,最好加个标识位,webview不可见的情况下直接调用completionHandler

@gdxz123
Copy link
Author

gdxz123 commented Jan 21, 2020

赞,这样即使销毁后弹窗也不会导致crash了。不过还是会出现webview已经关闭,仍然弹出alert框的情况,最好加个标识位,webview不可见的情况下直接调用completionHandler

最好别做这样的逻辑,因为不可见的情况可能有些业务逻辑就是要弹aler弹窗,本身出现这样的奔溃主要是因为webview释放了,但还在执行alert动作,我们修复这个bug就好了,不应在不可见的时候执行completionHanler,因为这样就改变了webview的特性了

Copy link
Author

@gdxz123 gdxz123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix: complete handler must be call before wkwebview dealloc

@gdxz123
Copy link
Author

gdxz123 commented Jan 21, 2020

赞,这样即使销毁后弹窗也不会导致crash了。不过还是会出现webview已经关闭,仍然弹出alert框的情况,最好加个标识位,webview不可见的情况下直接调用completionHandler

这个标记位可以加到业务层,库的层面没啥必要加吧

@ryanZhange
Copy link

方法可行,我也遇到这个问题了,希望能和入这个修改

Copy link
Author

@gdxz123 gdxz123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix(webview):解决H5异步延时事件触发且webview销毁时奔溃问题

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

Successfully merging this pull request may close these issues.

3 participants