• <bdo id='ua4hN'></bdo><ul id='ua4hN'></ul>

    <tfoot id='ua4hN'></tfoot>

    1. <i id='ua4hN'><tr id='ua4hN'><dt id='ua4hN'><q id='ua4hN'><span id='ua4hN'><b id='ua4hN'><form id='ua4hN'><ins id='ua4hN'></ins><ul id='ua4hN'></ul><sub id='ua4hN'></sub></form><legend id='ua4hN'></legend><bdo id='ua4hN'><pre id='ua4hN'><center id='ua4hN'></center></pre></bdo></b><th id='ua4hN'></th></span></q></dt></tr></i><div id='ua4hN'><tfoot id='ua4hN'></tfoot><dl id='ua4hN'><fieldset id='ua4hN'></fieldset></dl></div>

      <small id='ua4hN'></small><noframes id='ua4hN'>

    2. <legend id='ua4hN'><style id='ua4hN'><dir id='ua4hN'><q id='ua4hN'></q></dir></style></legend>
    3. UIWebView 占用大量内存

      UIWebView taking lots of memory(UIWebView 占用大量内存)

        <bdo id='QZXvt'></bdo><ul id='QZXvt'></ul>
        <legend id='QZXvt'><style id='QZXvt'><dir id='QZXvt'><q id='QZXvt'></q></dir></style></legend>
        • <i id='QZXvt'><tr id='QZXvt'><dt id='QZXvt'><q id='QZXvt'><span id='QZXvt'><b id='QZXvt'><form id='QZXvt'><ins id='QZXvt'></ins><ul id='QZXvt'></ul><sub id='QZXvt'></sub></form><legend id='QZXvt'></legend><bdo id='QZXvt'><pre id='QZXvt'><center id='QZXvt'></center></pre></bdo></b><th id='QZXvt'></th></span></q></dt></tr></i><div id='QZXvt'><tfoot id='QZXvt'></tfoot><dl id='QZXvt'><fieldset id='QZXvt'></fieldset></dl></div>
          <tfoot id='QZXvt'></tfoot>

            <tbody id='QZXvt'></tbody>

              <small id='QZXvt'></small><noframes id='QZXvt'>

              • 本文介绍了UIWebView 占用大量内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                在我的应用程序中,当我使用任何网站 url 加载 UIWebView 时,内存从 30mb 跳到大约 140mb.我正在使用 ARC

                In my app when i load UIWebView with any Website url the memory jumps from 30mb to around 140mb. I am using ARC


                当关闭包含 UIWebView 的 UIWebViewController[Viewcontroller] 时,它不会释放内存.任何人都可以帮助我如何解决这个内存问题,还请在 ARC


                and when dismissing the UIWebViewController[Viewcontroller which contains UIWebView], it doesnt releases the memory. Can any body help me how to solve this memory issues as well as please also provide me pointers of memory bestpractices in ARC

                用于加载网页:-

                NSURL *nsurl=[NSURL URLWithString:self.url];
                    NSURLRequest *nsrequest=[NSURLRequest requestWithURL:nsurl];
                    [webview loadRequest:nsrequest];
                

                对于关闭视图控制器:-

                FOr Dismissing the Viewcontroller:-

                [self dismissViewControllerAnimated:YES completion:^{
                    webview.delegate=nil;
                    webview=nil;
                }];
                

                在此先感谢 :)

                推荐答案

                哇,今天我们也遇到了这个问题.当我们尝试加载包含大量图片或巨大网页的网页时,很容易崩溃.我们还发现内存使用了将近200M.

                wow, today we also meet this problem. when we try to load a web page which contain lots pictures or a huge web page, it's easy to crash. we also find the memory used nearly 200M.

                最后我们发现我们可以移除网页视图的内存缓存

                finally we find that we could remove the memory cache of web view

                [[NSURLCache sharedURLCache] removeAllCachedResponses];
                

                您可以在收到内存警告时尝试.或者你可以在 dealloc 方法中调用它.

                you can try it when you receive memory warning. or you can call it in the dealloc method.

                如果还是有问题,尝试通过调用限制内存缓存大小

                if it still have some problems, try to limit the memory cache size by call

                [[NSURLCache sharedURLCache] setMemoryCapacity:size]
                

                祝你好运!

                这篇关于UIWebView 占用大量内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                EAAccessory/EASession teardown during background(EAAccessory/EASession 在后台拆除)
                Getting an NSArray of a single attribute from an NSArray(从 NSArray 获取单个属性的 NSArray)
                ImageIO: lt;ERRORgt; JPEG Corrupt JPEG data: premature end of data segment iphone - how to catch this?(ImageIO:lt;错误gt;JPEG 损坏的 JPEG 数据:iphone 数据段过早结束 - 如何捕捉到这个?)
                How to get indexPath.row of tableView which is currently being displayed?(如何获取当前正在显示的 tableView 的 indexPath.row?)
                Xcode iOS organizer submit to app store yields quot;The archive is invalidquot; error(Xcode iOS 管理器提交到应用商店产生“存档无效;错误)
                MFMessageComposeViewController alloc returns nil(MFMessageComposeViewController alloc 返回 nil)
                  • <i id='yR1H5'><tr id='yR1H5'><dt id='yR1H5'><q id='yR1H5'><span id='yR1H5'><b id='yR1H5'><form id='yR1H5'><ins id='yR1H5'></ins><ul id='yR1H5'></ul><sub id='yR1H5'></sub></form><legend id='yR1H5'></legend><bdo id='yR1H5'><pre id='yR1H5'><center id='yR1H5'></center></pre></bdo></b><th id='yR1H5'></th></span></q></dt></tr></i><div id='yR1H5'><tfoot id='yR1H5'></tfoot><dl id='yR1H5'><fieldset id='yR1H5'></fieldset></dl></div>

                        <tbody id='yR1H5'></tbody>
                          <bdo id='yR1H5'></bdo><ul id='yR1H5'></ul>
                          <legend id='yR1H5'><style id='yR1H5'><dir id='yR1H5'><q id='yR1H5'></q></dir></style></legend>

                        • <tfoot id='yR1H5'></tfoot>

                        • <small id='yR1H5'></small><noframes id='yR1H5'>