What does NSURLConnection's error code "-1009" mean?

jxx picture jxx · Jul 14, 2011 · Viewed 44.6k times · Source

When I send a request and get an error with the error code -1009, what does that mean? I'm not sure how to handle it.

- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error{
      NSLog(@"connection didFailWithError");

   if(error.code==-1009){       
      //do something           
   }    
}

Answer

DarkDust picture DarkDust · Jul 14, 2011

Since the error returned should be within the NSURLErrorDomain, the code -1009 means:

NSURLErrorNotConnectedToInternet

Returned when a network resource was requested, but an internet connection is not established and cannot be established automatically, either through a lack of connectivity, or by the user's choice not to make a network connection automatically.