UIWebView throwing exception for [WebActionDisablingCALayerDelegate setBeingRemoved:]

前端 未结 6 1896
清酒与你
清酒与你 2021-01-30 01:31

When running against iOS 8, I began to see the following exception coming from the deep bowels of UIWebView:

[WebActionDisablingCALayerDelega

相关标签:
6条回答
  • 2021-01-30 02:06

    As none of the answers given could help me I had to resolve this issue with help of Objective-C runtime.

    First I've 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.

    0 讨论(0)
  • 2021-01-30 02:13

    Not sure if this is your case, but I also started seeing this problem on iOS 8 and we tracked it down to the usage of the following CSS property on an iframe:

    -webkit-overflow-scrolling: touch;
    

    After we removed it, we no longer had those error messages.

    Note: in my case, it didn't happen in response to changing any constraints, but rather it happened while we were navigating through the HTML.

    0 讨论(0)
  • 2021-01-30 02:15

    In my case the problem was a <table> inside of iframe content. The table width was greater than the iframe width defined via CSS. The iframe scrolling was off, and the table has stretched the iframe to the minimum calculated width of the table. Other side effect: content of the iframe was 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 table form iframe content has fixed the problem.

    0 讨论(0)
  • 2021-01-30 02:16

    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. Also, it may improve the performance compared with it predecessor. Seems likely that Apple will make the de-facto standard in the near future, if not now. It has interfaces and delegates somewhat similar to UIWebView. Definitively worth a try.

    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

    0 讨论(0)
  • 2021-01-30 02:17

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

    0 讨论(0)
  • 2021-01-30 02:19

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

    Edit: I was able to continue using display:none to hide my scrolling element by putting -webkit-overflow-scrolling:touch; inside of its own class .scroll and using jquery to add and remove that class from my scrolling 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 讨论(0)
提交回复
热议问题