[英]iOS: Does Anyone Know why I'm getting a 999 error, even though the page loads?
I added NSLogs to all of my UIWebView delegate methods and viewDidLoad to track everything, and for some reason I see a 999 error, and multiple "DidFinishLoad" calls. 我将NSLogs添加到我的所有UIWebView委托方法和viewDidLoad来跟踪所有内容,由于某种原因,我看到了999错误,以及多个“DidFinishLoad”调用。 Does anyone know how to optimize this? 有谁知道如何优化这个?
Here's my log: 这是我的日志:
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
Here's how I load my webView in viewDidLoad: 这是我在viewDidLoad中加载webView的方法:
NSURL *url = [NSURL URLWithString:shoeLink];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[shoeWebView loadRequest:requestObj];
Is there I way for me to optimize this so that I can get the fastest possible load time? 我可以通过这种方式对其进行优化,以便获得最快的加载时间吗? Thanks and happy holidays! 谢谢,节日快乐!
The UIWebView delegate callback methods for shouldStart, didStart, and didFinish are called for each frame of the webpage that is loaded. 为加载的网页的每个帧调用shouldStart,didStart和didFinish的UIWebView委托回调方法。 That is why you see these calls repeated so many times for certain webpages. 这就是为什么你会看到这些调用对于某些网页重复这么多次的原因。 As you can tell from the logs, something about loading one of those frames fails, but the rest of them load fine, which is why you are still able to see the webpage. 从日志中可以看出,加载其中一个框架的内容失败了,但其余部分加载正常,这就是为什么你仍然可以看到网页的原因。
About the second part of your question, there is no real optimization than can be done to make this all happen faster, you have made the request in the correct way. 关于问题的第二部分,没有真正的优化可以使这一切更快地发生,你已经以正确的方式提出了请求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.