Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I fix NSURLErrorDomain error -999 in iPhone 3.0 OS

I am trying to update my iPhone app to work with OS 3.0. I have a UIWebView that shows a page fine. But when I click a link it calls my delegate for didFailLoadWithError and the error is Operation could not be completed. (NSURLErrorDomain error -999.) I verified this is still working with OS 2.2.1, so it is something changed in 3.0.

Any ideas?

like image 874
dp. Avatar asked Jun 21 '09 21:06

dp.


2 Answers

I was able to find the answer here.

This thread contained this description for this error: This error may occur if an another request is made before the previous request of WebView is completed...

I worked around this by ignoring this error and letting the webview continue to load.

if ([error code] != NSURLErrorCancelled) { //show error alert, etc. } 
like image 80
dp. Avatar answered Oct 12 '22 03:10

dp.


NSURLErrorCancelled (-999)

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

For my situation (and probably yours) this can be ignored:

if([error code] == NSURLErrorCancelled) return; // Ignore this error 
like image 32
BadPirate Avatar answered Oct 12 '22 02:10

BadPirate