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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With