Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Major performance loss in UIWebView on iOS 9

I have boiled down my issue to a very simple scenario and it appears to be with iOS 9+ and UIWebView with a website that has lots of page loads (like you would get from navigating).

I followed this tutorial (http://conecode.com/news/2011/05/ios-tutorial-creating-a-web-view-uiwebview/) to build a simple iOS app with a UIWebView. I pointed the UIWebView at a static html that looks like what I have at the bottom.

I then refreshed the page with the button (or the script that does it automaticly) and eventually the app grows slower and slower (usually around 50-80 refreshes). I have the list in the page for demonstration because it allows you to scroll, which highlights the issue much sooner.

Any help or direction for me to look into resolving this issue?

<!DOCTYPE html>
<html lang="en">
<head></head>
<body>
<FORM><INPUT id="demo" TYPE="button" onClick="history.go(0)" VALUE="refresh"></FORM>
    <ul data-role="listview" >
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
                <li>This is an Item</li>    
    </ul>
    <script>
        var elem = document.getElementById("demo");
        elem.value = Date();
        location.reload();
    </script>    
</body>
</html>
like image 867
XenoPuTtSs Avatar asked Oct 28 '15 21:10

XenoPuTtSs


People also ask

How do I clear cache in iOS WebView?

How do I clear cache in iOS WebView? Open Settings. Swipe down and tap Safari. Swipe down again and tap Clear History and Website Data, tap it once again to confirm.

What is UIWebView in iOS?

What is UIWebView? UIWebView is a deprecated iOS user interface control in Apple's UIKit framework. It loads HTML files and web content into an app view, rendering them as they would appear in a browser window.


1 Answers

Maybe a memory issue.
Watch the Memory Report (enlarge with double click) in Xcode while running the project and reloading/navigating the UIWebView.

enter image description here

If it is growing, try to delete the UIWebViews cache

Clearing UIWebview cache

like image 150
Yedy Avatar answered Sep 22 '22 11:09

Yedy