Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebKit throwing exception on iOS 8 for call to setBeingRemoved:

I have an app which relies on UIWebViews for some of its screens, but starting on iOS 8 I started seeing the following exception being thrown occasionally:

WebKit discarded an uncaught exception in the webView:willRemoveScrollingLayer:withContentsLayer:forNode: delegate: <NSInvalidArgumentException> -[WebActionDisablingCALayerDelegate setBeingRemoved:]: unrecognized selector sent to instance (...)

This will normally happen in response to tapping a button or link on the webview (without anything else going on on the Objective-C side), and after that most of the functionality in the webview will be broken (links not clickable, etc).

I have seen at least one other question referring to this error message, but no conclusive answers yet.

Has anyone ran into this issue and figured out what was wrong / what causes it? It appears to depend entirely on the HTML content, meaning that the fact that this exception is thrown is an iOS 8 bug.

like image 600
André Morujão Avatar asked Oct 06 '14 13:10

André Morujão


2 Answers

Turns out this error was caused by the use of the following CSS property on an iframe in my HTML:

-webkit-overflow-scrolling: touch;

Removed it (we're now looking for a suitable alternative) and the UIWebView no longer crashes.

like image 117
André Morujão Avatar answered Sep 27 '22 23:09

André Morujão


You can use WKWebView instead of UIWebView. (it was first included in iOS 8). I've tried it, and seems that it hasn't got this bug.

If you are targeting pre-iOS 8, you can implement fallback procedures to load either UIWebView or WKWebView, here you are an out-of-the-box implementation

like image 24
webo80 Avatar answered Sep 27 '22 23:09

webo80