iOS 11.3(和11.4)中的UIWebView崩溃

前端之家收集整理的这篇文章主要介绍了iOS 11.3(和11.4)中的UIWebView崩溃前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我们有一个带有UIWebView的混合iOS应用程序,它可以加载一个相当复杂的网上商店(一堆跟踪像素,javasript,异步行为).自iOS 11.3推出以来,我们看到许多崩溃似乎来自UIWebView或相关组件.堆栈跟踪看起来像这样
  1. Crashed: WebThread
  2. 0 WebCore 0x18b7b0d98 WebCore::Page::sessionID() const + 162
  3. 1 WebKitLegacy 0x18be91204 WebFrameNetworkingContext::storageSession() const + 24
  4. 2 WebCore 0x18ad818bc WebCore::ResourceHandle::willSendRequest(WebCore::ResourceRequest&&,WebCore::ResourceResponse&&,WTF::CompletionHandler<void (WebCore::ResourceRequest&&)>&&) + 1012
  5. 3 WebCore 0x18ad86f88 WTF::Function<void ()>::CallableWrapper<-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]::$_1>::call() + 208
  6. 4 JavaScriptCore 0x1892157d4 WTF::dispatchFunctionsFromMainThread() + 344
  7. 5 Foundation 0x1830fe0ec __NSThreadPerformPerform + 340
  8. 6 CoreFoundation 0x18265b404 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
  9. 7 CoreFoundation 0x18265ac2c __CFRunLoopDoSources0 + 276
  10. 8 CoreFoundation 0x18265879c __CFRunLoopRun + 1204
  11. 9 CoreFoundation 0x182578da8 CFRunLoopRunSpecific + 552
  12. 10 WebCore 0x18a805dcc RunWebThread(void*) + 592
  13. 11 libsystem_pthread.dylib 0x1822d9220 _pthread_body + 272
  14. 12 libsystem_pthread.dylib 0x1822d9110 _pthread_body + 290
  15. 13 libsystem_pthread.dylib 0x1822d7b10 thread_start + 4

我们看不到我们的代码的路径,并且怀疑在UIWebView的JavaScript运行时触发了错误,但是没有想法.

解决方法

我通过在JavaScriptCore(WebKit)中禁用JIT解决了这个问题.

我把它放在我的AppDelegate中:

  1. setenv("JSC_useJIT","false",0);

我希望这将有所帮助.

亲切的问候,约什.

猜你在找的iOS相关文章