Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix WebCore crashes in UIWebView?

My app makes heavy use of UIWebView's in iOS 7 and 8. I get frequent crash reports affecting a small number of users relating to Web Core. I have already been setting the webview delegate to nil when its view controller disappears, as suggested in other answers. However, I still get numerous crashes like:

WebCore::SharedBuffer::clear()
WebCore::TimerBase::updateHeapIfNeeded(double)
WebCore::WebVideoFullscreenModelMediaElement::updateForEventName
WebCore::HTMLMediaElement::seekTimerFired
WebCore::EventTarget::fireEventListeners
WebCore::CachedResource::unregisterHandle
WebCore::CSSFontSelector::~CSSFontSelector()
WebCore::MediaQueryMatcher::styleResolverChanged

I have a few thousand daily users, but get probably 5 crashes a day with stack traces like the above, so I'm never able to reproduce. What else can I do to prevent UIWebView crashes?

like image 891
Erich Avatar asked Oct 20 '14 01:10

Erich


1 Answers

Are you using UIWebView instances with delegate in some places?, did you try to nil the delegate in the dealloc method of the view controller or view?

- (void)dealloc
{
    self.webView.delegate = nil;
}

No matter if you are using ARC or non-ARC, this is very important.

like image 145
southfox Avatar answered Nov 12 '22 15:11

southfox