开发者

Controlling memory spikes when loading local (Office and iWork) files in UIWebView

I am using UIWebView to open local files开发者_Go百科 of Office (ppt, xls, doc) and iWork (numbers, pages, key) formats, all less than 5 MB in size. To load them, I simply do:

NSURL *url = [NSURL fileURLWithPath:filepath];      
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[myWebView loadRequest:requestObj];

When loading some of these files in web view (especially ppts with large number of images in them), the memory usage shoots up to almost 35 MB causing my app to crash. I have looked around various iOS forums but haven't really found a solution. Does using loadData:MIMEType:textEncodingName:baseURL: help in keeping the memory footprint down or are there any other tricks to using UIWebView?


That shouldn't be the case for a crash. An app using 35MB of RAM is not too much. I suggest you run the static analyzer for leaks. Also, what type of crash do you get? Do you see memory warnings being issued just before it crashes?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜