UIWebView throw exception for [WebActionDisablingCALayerDelegate setBeingRemoved:]

When working with iOS 8, I began to see the following exception from the depth of UIWebView :

[WebActionDisablingCalayerDelegate setBeingRemoved:]: unrecognized selector sent to instance 0x167ee900

* WebKit canceled the uncaught exception in webView: willRemoveScrollingLayer: withContentsLayer: forNode: delegate: - [WebActionDisablingCalayerDelegate setBeingRemoved:

This happens when I change some restrictions on my UIWebView and then call:

  self.webViewWidthConstraints.constant = newWidth; [self.webView setNeedsLayout]; [self.webView layoutIfNeeded]; 

(This means that the content of the webview is re-rendered so that it matches its width).

Fortunately, the exception is thrown, so the application does not crash. Why is this happening, and is there a way to prevent this?

+42
ios objective-c ios8 uiwebview
Sep 17 '14 at 15:06
source share
6 answers

I found that adding "-webkit-transform: translateZ (0px);" to scrollable content (I have a div inside my scrollable container), it fixed the problem for me. Hope this helps.

+12
Nov 07 '14 at 17:22
source share
— -

Not sure if this is your case, but I also started to see this issue in iOS 8, and we tracked it down to using the following CSS property in the iframe:

 -webkit-overflow-scrolling: touch; 

After we deleted it, we no longer had these error messages.

Note: in my case, this did not happen in response to a change in any restrictions, but rather it happened while navigating HTML.

+9
Oct 07
source share

Since none of the answers above helped me, I had to solve this problem with Objective-C runtime.

First I provided a simple function:

 id setBeingRemoved(id self, SEL selector, ...) { return nil; } 

Then these two lines:

  Class class = NSClassFromString(@"WebActionDisablingCALayerDelegate"); class_addMethod(class, @selector(setBeingRemoved:), setBeingRemoved, NULL); 

And it works.

+7
Nov 26 '15 at 13:06
source share

Use WKWebView instead of UIWebView . (It was first included in iOS 8). I have tried this and it seems that it does not have this error. In addition, it can improve performance over its predecessor. Apple seems to be making a de facto standard in the near future, if not now. It has interfaces and delegates, somewhat similar to UIWebView. Definitely worth a try.

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

+3
Jan 20 '16 at 16:19
source share

In my case, the problem was <table> inside the iframe content. The width of the table was greater than the width of the iframe defined using CSS. Iframe scrolling was turned off, and the table stretched the iframe to the minimum calculated width of the table. Another side effect: the contents of the iframe were not completely visible (cut off on the right side).

 |--- Available viewport width -------------| |--- defined and estimated iframe width ---| |--- table width in the iframe content > than defined iframe width ---| |--- iframe stretched to the calculated table width ------------------| 

Removing the iframe table form fixes the problem.

0
Jun 02 '15 at 13:44
source share

As @ André Morujão said, removing -webkit-overflow-scrolling:touch; from the scroll item stops the exception. But I found that the exception only occurred when I added display:none css to the scroll element.

Edit: I was able to continue using display:none to hide my scroll element by putting -webkit-overflow-scrolling:touch; inside your own .scroll class and using jquery to add and remove this class from my scrollable element before and after hiding it

 <style> .scroll { -webkit-overflow-scrolling:touch; } </style> <script> function hide() { $('#scrolling_element).removeClass('scroll'); $('#scrolling_element).css('display', 'none'); } function show() { $('#scrolling_element).css('display', 'block'); $('#scrolling_element).addClass('scroll'); } </script> 
0
Sep 23 '15 at 4:34
source share



All Articles