UIWebview大小限制 [英] UIWebview size limit

查看:57
本文介绍了UIWebview大小限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次我加载大于2MB的html文件时,我的应用都会崩溃.网页的大小有限制吗?我怎么不崩溃我的应用程序(部分加载?)

Everytime I load a html file that is larger than 2MB my app crashes. Is there a limit to how big a web page can be? How can I not crash my app (partial loading?)

推荐答案

加载2MB的HTML时,UIWebView必须消耗大量内存才能创建DOM和所有控件/图形/等.实际显示页面.限制不是HTML大小,而是显示它所需的结果内存量.在带有活动监视器的模拟器中运行它,以查看内存消耗

When you load 2MB of HTML, the UIWebView has to consume a lot of memory to create a DOM and all of the controls/graphics/etc. to actually show the page. The limit is not the HTML size, but the resulting amount of memory that is needed to display it. Run it in the simulator with the Activity Monitor to see memory consumption

Xcode Instruments:iPhone应用程序的峰值RAM正在运行在模拟器中?

您需要分解页面或找到其他方法来做标记以减小内存.请注意,如果需要创建同一页面,仅缩小HTML可能无济于事.

You'll need to break down your pages or find another way to do the markup to make the memory smaller. Note that just making the HTML smaller might not help if you need to create the same page.

这篇关于UIWebview大小限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆