<small id='0KF5y'></small><noframes id='0KF5y'>

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

      1. 忽略 NSURLErrorDomain 错误 -999 在 UIWebView 中不起作用

        时间:2023-10-22
      2. <small id='7B6fq'></small><noframes id='7B6fq'>

          <tbody id='7B6fq'></tbody>
        • <bdo id='7B6fq'></bdo><ul id='7B6fq'></ul>

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

          • <tfoot id='7B6fq'></tfoot><legend id='7B6fq'><style id='7B6fq'><dir id='7B6fq'><q id='7B6fq'></q></dir></style></legend>

                  本文介绍了忽略 NSURLErrorDomain 错误 -999 在 UIWebView 中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我试图避免在 UIWebView 的委托返回这样的错误时产生的问题.我的委托实现中有常见的解决方法(我在 Internet 的任何地方都看到过)

                  I'm trying to avoid the problem generated while UIWebView's delegate returns an error like that. I have the common workaround (I saw it anywhere in the Internet) in my delegate implementation

                  - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
                  
                      if ([error code] == NSURLErrorCancelled) return;
                  }
                  

                  我遇到的问题是这并不总是有效.有时会加载网页,有时会加载网页的某些部分(标题、文本的一部分……),有时不会加载任何内容.

                  The problem I have is that this does not works always. Sometimes loads the web, another times loads parts of the web (the header, a part of the text...) and several times does not load anything.

                  还有其他解决方案吗?是否存在任何可以正常工作的浏览器的开源实现?

                  Is there any other solution to this? Exists any open source implementation of a browser that works properly?

                  推荐答案

                  来自 Apple 文档:

                  From Apple docs:

                  NSURLErrorCancelled (-999)

                  NSURLErrorCancelled (-999)

                  " 取消异步加载时返回.Web Kit 框架委托在对加载资源执行取消操作时将收到此错误.请注意,如果下载被取消,NSURLConnection 或 NSURLDownload 委托将不会收到此错误."

                  "Returned when an asynchronous load is canceled. A Web Kit framework delegate will receive this error when it performs a cancel operation on a loading resource. Note that an NSURLConnection or NSURLDownload delegate will not receive this error if the download is canceled."

                  因此,最有可能发生这种情况的情况是,在第一个请求完成之前,您先加载一个请求,然后再加载另一个请求(或同一个请求).这可能发生.例如,如果您在像 viewDidAppear: 这样可以多次调用的方法中调用 loadRequest(或 loadHTMLString).如果您快速点击 UIWebView 中的 2 个链接,也会发生这种情况.

                  So, the most likely case for this to happen is for you to load a request and then another one (or the same one), before the first one is completed. This can happen. e.g., if you call loadRequest (or loadHTMLString) in a method like viewDidAppear: that can be called multiple times. This has also been reported to happen if you quickly tap 2 links in the UIWebView.

                  因此,一般建议是查看您调用 loadRequest(或 loadHTMLString)的方式和位置,并可能提供一些代码.

                  So, the general suggestion is to review how and where you call loadRequest (or loadHTMLString), and possibly provide some code.

                  为了解决这个问题,我建议将以下跟踪添加到您的 Web 视图委托:

                  In order to troubleshoot this, I would suggest to add the following traces to your web view delegate:

                  - (void)webViewDidStartLoad:(UIWebView *)webView {
                        NSLog(@"Starting to download request: %@", [webView.request.URL absoluteString]);
                  }
                  
                  - (void)webViewDidFinishLoad:(UIWebView *)webView {
                        NSLog(@"Finished downloading request: %@", [webView.request.URL absoluteString]);
                  }
                  
                  - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
                  
                      if ([error code] == NSURLErrorCancelled)
                        NSLog(@"Canceled request: %@", [webView.request.URL absoluteString]);
                  }
                  

                  如果您检查输出,您应该更清楚地看到发生了什么.如果您粘贴输出,我们可以尝试进一步帮助您.

                  If you inspect the output, you should see more clearly what is going on. If you paste the output, we could try and help you further.

                  这篇关于忽略 NSURLErrorDomain 错误 -999 在 UIWebView 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 iOS4 中损坏的 UIWebView 中播放视频? 下一篇:iOS WKWebView 检测何时到达底部

                  相关文章

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

                  <legend id='lAxba'><style id='lAxba'><dir id='lAxba'><q id='lAxba'></q></dir></style></legend>

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

                1. <tfoot id='lAxba'></tfoot>

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