<tfoot id='HtjQd'></tfoot>

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

        <bdo id='HtjQd'></bdo><ul id='HtjQd'></ul>

    1. <legend id='HtjQd'><style id='HtjQd'><dir id='HtjQd'><q id='HtjQd'></q></dir></style></legend>

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

      1. UIWebView 没有完成加载?

        UIWebView not finishing loading?(UIWebView 没有完成加载?)
          <legend id='GLzmI'><style id='GLzmI'><dir id='GLzmI'><q id='GLzmI'></q></dir></style></legend>
        • <tfoot id='GLzmI'></tfoot>

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

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

              <tbody id='GLzmI'></tbody>

              • <bdo id='GLzmI'></bdo><ul id='GLzmI'></ul>
                  本文介绍了UIWebView 没有完成加载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我的应用程序中有一个 webview.它会加载大部分页面,并且在加载完成时会调用函数 webViewDidFinishLoad.但是尽管页面似乎已加载,但某些页面加载并未完成.在这些情况下 - (void)webViewDidFinishLoad:(UIWebView *)webView(void)webView:(UIWebView *)webView didFailLoadWithError 都不会被调用.例如:转到网站 http://www.mynevadacounty.com/ 并点击任何UIWebView 中没有完成页面加载等项目.

                  I have a webview in my application.It loads most of the pages and the function webViewDidFinishLoad gets called when the loading finishes.But some of the pages loading doesn't finish although the pages appears to be loaded. In these cases neither - (void)webViewDidFinishLoad:(UIWebView *)webView nor (void)webView:(UIWebView *)webView didFailLoadWithError is getting called. For eg: Go to the site http://www.mynevadacounty.com/ and when you click on any of the items such as mobile the page loading doesn't finish in the UIWebView.

                  这可能是什么原因?

                  我尝试加载的这些网站中的大多数都是共享点网站

                  Most of these sites that i am trying to load are sharepoint sites

                  推荐答案

                  我最初在这里对这个异常做了一个问答:UIWebView 显示 UIActivityIndicator 用于加载,但在页面初始加载后忽略其他加载请求(例如 javascript 加载的广告)

                  I originally did a Q&A of this anomaly here: UIWebView show UIActivityIndicator for loading but ignore additional load requests (e.g. javascript loaded advertisements) after page initially loads

                  问题是网页将完成加载,然后开始加载其他元素(即广告、iFrame 等)解决方案是在页面加载开始时存储当前 URL,如果 url 与上次加载的 URL 相同,则在下次加载"时存储当前 URL,而不是误报...

                  The problem is that the webpage will finish loading and then it begins loading other elements afterwards (i.e. advertisements, iFrames, etc.) The solution is to store the current URL when page loading begins and the next time it is "Loading" if the url is the same as the last URL loaded than it's a false positive...

                  (在下面的代码中,网页在 //show UIActivityIndicator 上真正开始加载,并在 //hide 上真正完成主要内容(不是您正在努力处理的额外内容)的加载UIActivityIndicator)

                  (In the code below the web page truly starts loading on //show UIActivityIndicator and truly finishes loading the main content (not the extra content you are struggling with) on //hide UIActivityIndicator)

                  //Define the NSStrings "lastURL" & "currentURL" in the .h file.
                  //Define the int "falsepositive" in the .h file. (You could use booleans if you want)
                  //Define your UIWebView's delegate (either in the xib file or in your code)
                  
                  - (void)webViewDidFinishLoad:(UIWebView *)webView {
                      lastURL = [[NSString alloc] initWithFormat:@"%@", webView.request.mainDocumentURL];
                      if (falsepositive != 1) {
                          NSLog(@"Loaded");
                          //hide UIActivityIndicator
                      } else {
                          NSLog(@"Extra content junk (i.e. advertisements) that the page loaded with javascript has finished loading");
                          //This method may be a good way to prevent ads from loading hehe, but we won't do that
                      }
                  }
                  
                  -(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType; {
                      NSURL *requestURL =[request mainDocumentURL];
                      currentURL = [[NSString alloc] initWithFormat:@"%@", requestURL]; //not sure if "%@" should be used for an NSURL but it worked...
                      return YES;
                  }
                  
                  - (void)webViewDidStartLoad:(UIWebView *)webView {
                      if ([currentURL isEqualToString:lastURL]) {
                          falsepositive = 1;
                          NSLog(@"The page is loading extra content with javascript or something, ignore this");
                      } else {
                          falsepositive = 0;
                          NSLog(@"Loading");
                          //show UIActiviyIndicator
                      }
                  }
                  

                  这篇关于UIWebView 没有完成加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Android - Is it possible to get install referrer programmatically(Android - 是否有可能以编程方式安装引荐来源网址)
                  How to sign an APK with more than one certificate?(如何使用多个证书签署 APK?)
                  What does this Google Play APK publish error message mean?(这个 Google Play APK 发布错误消息是什么意思?)
                  Lost my keystore for uploaded app on android market(丢失了我在 android 市场上上传的应用程序的密钥库)
                  App on Google Play always shows quot;Updatequot; instead of open(Google Play 上的应用程序总是显示“更新;而不是打开)
                  How to restrict android app to specific device make?(如何将 android 应用程序限制为特定设备品牌?)
                • <small id='lPMXu'></small><noframes id='lPMXu'>

                      <bdo id='lPMXu'></bdo><ul id='lPMXu'></ul>

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