KingPolygon
KingPolygon

Reputation: 4755

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. 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:

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!

Upvotes: 0

Views: 1241

Answers (1)

Patrick Goley
Patrick Goley

Reputation: 5417

The UIWebView delegate callback methods for shouldStart, didStart, and didFinish are called for each frame of the webpage that is loaded. 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.

Upvotes: 2

Related Questions