Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is NSURLErrorCancelled = -999 in iOS?

Tags:

ios

Can some one describe how "NSURLErrorCancelled = -999" is used.

like image 648
madu Avatar asked Aug 19 '14 18:08

madu


3 Answers

From Apple docs:

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

best thing you can do about it is to ignore this error

if ([error code] != NSURLErrorCancelled) {
   //here you'll get a real error 
}
like image 186
jcesarmobile Avatar answered Sep 17 '22 14:09

jcesarmobile


This error might me caused by an invalid SSL certificate. If the framework you are using to execute the request tests for valid SSL, you should add the host you are trying to connect to on a whitelist of trusted hosts.

Hope that helps anyone :)

like image 29
Vinícius Rodrigues Avatar answered Sep 16 '22 14:09

Vinícius Rodrigues


When the URL redirects to another URL, we will receive an NSURLErrorCancelled error. And you have assigned a code value of -999 to that.

like image 42
Rahul Tripathi Avatar answered Sep 16 '22 14:09

Rahul Tripathi