ios - WebCore::UserGestureIndicator::processingUserGesture 中的 EXC_BAD_ACCESS (SIGSEGV)

标签 ios html websocket web-worker segmentation-fault

我有一个使用 UIWebView 和 HTML5 websockets 构建的 iOS 应用程序。该应用程序经历了看似随机的崩溃。它发生在用户与其交互时以及在用户与应用程序之间没有交互发生的生命周期测试期间。

崩溃日志都有以下内容:

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x00000000

线程日志包含:

Thread XX name:  WebCore: Worker
Thread XX Crashed:
0   WebCore                         0x36c8c7a0 WebCore::UserGestureIndicator::processingUserGesture() + 20
1   WebCore                         0x36d7070a WebCore::DOMTimer::DOMTimer(WebCore::ScriptExecutionContext*, WTF::PassOwnPtr<WebCore::ScheduledAction>, int, bool) + 74
2   WebCore                         0x36d70616 WebCore::DOMTimer::install(WebCore::ScriptExecutionContext*, WTF::PassOwnPtr<WebCore::ScheduledAction>, int, bool) + 46
3   WebCore                         0x3753ae7e WebCore::WorkerContext::setTimeout(WTF::PassOwnPtr<WebCore::ScheduledAction>, int) + 30
4   WebCore                         0x3731ac02 WebCore::JSWorkerContext::setTimeout(JSC::ExecState*) + 194
5   WebCore                         0x37318ff6 WebCore::jsWorkerContextPrototypeFunctionSetTimeout(JSC::ExecState*) + 110
6   JavaScriptCore                  0x2fa9a1d8 llint_native_call_trampoline + 62
7   JavaScriptCore                  0x2faa355a JSC::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 66
8   WebCore                         0x36db0b16 WebCore::JSEventListener::handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event*) + 558
9   WebCore                         0x36d6ebba WebCore::EventTarget::fireEventListeners(WebCore::Event*, WebCore::EventTargetData*, WTF::Vector<WebCore::RegisteredEventListener, 1ul, WTF::CrashOnOverflow>&) + 482
10  WebCore                         0x36c6da2a WebCore::EventTarget::fireEventListeners(WebCore::Event*) + 174
11  WebCore                         0x36e28824 WebCore::EventTarget::dispatchEvent(WTF::PassRefPtr<WebCore::Event>) + 60
12  WebCore                         0x3753e596 WebCore::MessageWorkerContextTask::performTask(WebCore::ScriptExecutionContext*) + 222
13  WebCore                         0x3753ec6e WebCore::WorkerRunLoop::runInMode(WebCore::WorkerContext*, WebCore::ModePredicate const&, WebCore::WorkerRunLoop::WaitMode) + 158
14  WebCore                         0x3753eb94 WebCore::WorkerRunLoop::run(WebCore::WorkerContext*) + 60
15  WebCore                         0x37540d64 WebCore::WorkerThread::workerThread() + 432
16  JavaScriptCore                  0x2fa4ba68 WTF::wtfThreadEntryPoint(void*) + 12
17  libsystem_pthread.dylib         0x397b6c5a _pthread_body + 138
18  libsystem_pthread.dylib         0x397b6bca _pthread_start + 98
19  libsystem_pthread.dylib         0x397b4ccc thread_start + 4

我设法捕获了抛出的异常,据我所知,它看起来是一个框架错误。请参阅随附的屏幕截图。

enter image description here

我读过的大部分内容似乎都表明 Web View 在委托(delegate)触发之前被释放,但我的代码中没有任何地方释放!

有没有人遇到过这个或者类似的情况?非常感谢任何帮助!

更新

在联系开发人员支持后,我已向 Apple 提交了错误报告。他们的工程师确认这是一个错误。

最佳答案

在我的案例中,我有类似的问题。

WebView Crash

正如许多人所说,这可能是由于在释放 webview 时调用 WebView 委托(delegate)方法。

为了修复,我们需要将 delegate 设置为 nil 并在指定方法处停止 webview 请求

您必须添加以下代码行

-(void)viewDidUnload{
    [super viewDidUnload];

    webViewRef.delegate = nil;
    [webViewRef stopLoading];

}

-(void)backBtnClicked{

    webViewRef.delegate = nil;
    [webViewRef stopLoading];

}

希望对你有帮助。

关于ios - WebCore::UserGestureIndicator::processingUserGesture 中的 EXC_BAD_ACCESS (SIGSEGV),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20862757/

相关文章:

ios - 获取 UIViewController 的大小类最容易的是什么?

ios - 上一个/下一个 类似 iOS 邮件应用程序的功能吗?

spring - 没有 'javax.websocket.server.ServerContainer' ServletContext 属性 - Glassfish 4.1

javascript - 尝试使用 HTML 和 Javascript 在方程式中使用输入的用户变量

php - 如何让用户的浏览器忘记包含刷新重定向的缓存 index.html 文件?

Scala、Play、Akka、Websocket : how to pass actor messages through websocket

javascript - 修改现有的双工 WCF 服务以与 JavaScript 一起使用

java - SHA256 : different output in Swift and Java?

ios - 使用 Cocoa 在 Swift 中的性能

html - Bootstrap-4 垂直导航栏卡住折叠