UIWebView webCore crashes in iOS7.1 (example: www.latimes.com)

耗尽温柔 提交于 2019-12-10 17:46:59

问题


I have being seeing crashes in my iOS app, when opening LA Times (www.latimes.com). The crash happens in WebCore somewhere and I have no clue where. Profiling with both "Zombie" or "leaks" do not return anything for this "EXE_BAD_ADDRESS" error.

I also checked with a small, bare UIWebView app and I could reproduce the effects.

Right now, I see this happening only with LA times, but I am not sure if there are other sites as well.

Can someone check on and guide me in what could be the possible error/source for this crash?

EDIT: I have added a small UIWebView project demonstrating this bug at github

EDIT 2: The app (include the demo at github) works perfectly fine on iOS 7.0, but crashes in iOS 7.1 ... seems a recent bug with iOS 7.1. I have issued a bug report to Apple and will keep updated. Thanks in advance, Nikhil


回答1:


I happened to bump into that same issue with one of my apps in iOS>7.0 only.

It seems to be a sync issue which can be fixed by creating the webview from the main thread only.

As a fix I just wrapped my UIWebView creation in a dispatch_sync(dispatch_get_main_queue(), ^{ ... });

And it solved the problem. Of course if your code is running on the main thread you shouldn't wrap it this way ;)



来源:https://stackoverflow.com/questions/20196235/uiwebview-webcore-crashes-in-ios7-1-example-www-latimes-com

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!