简体   繁体   中英

Loading large web page in UIWebView

Whenever I load a large web page in a UIWebView in my app, it always crashes (low memory) after a few seconds before the page is fully loaded. The page is about 500k in size. the page loads fine in safari, however i noticed that the entire page is not rendered initially. (showing a checkerboard background)

How can I do that so that UIWebView doesn't crash when loading a big file?

Well One simple approach that works in Optimizing UIWebView is pretty simple and I found it effective in one of my app. Creating new instances of UIWebView each time on user's action is not a feasible solution and most likely crashes the app after a few loads. Keep a Single Instance of UIWebView that you can work with throughout your app, so that you don't have to call ALLOC on UIWebView every time you want to load a web page. Just use the UIWebView's loadRequest: method to change the URL you want to point the user to. I hope this reduces you memory consumption.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM