gpt4 book ai didi

iOS:有谁知道为什么我会收到 999 错误,即使页面已加载?

转载 作者:行者123 更新时间:2023-11-28 22:19:33 25 4
gpt4 key购买 nike

我将 NSLogs 添加到我的所有 UIWebView 委托(delegate)方法和 viewDidLoad 中以跟踪所有内容,出于某种原因,我看到了 999 错误和多个“DidFinishLoad”调用。有谁知道如何优化这个?

这是我的日志:

2013-12-25 23:56:51.656 VA[10598:60b] View Did Load
2013-12-25 23:56:52.216 VA[10598:60b] Should Start Load with request.
2013-12-25 23:56:52.219 VA[10598:60b] Webview did start load.
2013-12-25 23:56:53.531 VA[10598:60b] Should Start Load with request.
2013-12-25 23:56:53.536 VA[10598:60b] failed with error. Error Domain=NSURLErrorDomain Code=-999 "The operation couldn’t be completed. (NSURLErrorDomain error -999.)" UserInfo=0x16e4e240 {NSErrorFailingURLKey=http://myexamplesite.com/us/en_us, NSErrorFailingURLStringKey=http://myexamplesite.com/us/en_us}
2013-12-25 23:56:53.549 VA[10598:60b] Webview did start load.
2013-12-25 23:56:54.259 VA[10598:60b] Should Start Load with request.
2013-12-25 23:56:54.260 VA[10598:60b] Webview did start load.
2013-12-25 23:56:54.263 VA[10598:60b] Webview Did Finish Load
2013-12-25 23:56:54.266 VA[10598:60b] Should Start Load with request.
2013-12-25 23:56:54.267 VA[10598:60b] Webview did start load.
2013-12-25 23:56:54.269 VA[10598:60b] Webview Did Finish Load
2013-12-25 23:56:54.293 VA[10598:60b] Should Start Load with request.
2013-12-25 23:56:54.294 VA[10598:60b] Webview did start load.
2013-12-25 23:56:54.300 VA[10598:60b] Should Start Load with request.
2013-12-25 23:56:54.301 VA[10598:60b] Webview did start load.
2013-12-25 23:56:54.402 VA[10598:60b] Should Start Load with request.
2013-12-25 23:56:54.403 VA[10598:60b] Webview did start load.
2013-12-25 23:56:54.405 VA[10598:60b] Webview Did Finish Load
2013-12-25 23:56:54.509 VA[10598:60b] Should Start Load with request.
2013-12-25 23:56:54.510 VA[10598:60b] Webview did start load.
2013-12-25 23:56:54.653 VA[10598:60b] Webview Did Finish Load
2013-12-25 23:56:54.861 VA[10598:60b] Webview Did Finish Load
2013-12-25 23:56:54.914 VA[10598:60b] Webview Did Finish Load
2013-12-25 23:56:54.921 VA[10598:60b] Webview Did Finish Load

这是我在 viewDidLoad 中加载 webView 的方式:

NSURL *url = [NSURL URLWithString:shoeLink];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[shoeWebView loadRequest:requestObj];

我有什么方法可以优化它,以便获得最快的加载时间吗?谢谢,节日快乐!

最佳答案

为加载的网页的每一帧调用 shouldStart、didStart 和 didFinish 的 UIWebView 委托(delegate)回调方法。这就是为什么您会看到这些调用在某些网页上重复了很多次。从日志中可以看出,加载其中一个框架失败,但其余框架加载正常,这就是您仍然能够看到该网页的原因。

关于你问题的第二部分,没有真正的优化可以让这一切发生得更快,你已经以正确的方式提出了请求。

关于iOS:有谁知道为什么我会收到 999 错误,即使页面已加载?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20781321/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com