ios – NSURLConnection的错误代码“-1009”是什么意思?

当我发送请求并得到错误代码-1009的错误,这是什么意思?我不知道如何处理它。

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

   if(error.code==-1009){       
      //do something           
   }    
}
最佳答案
由于返回的错误应在NSURLErrorDomain内,所以code -1009表示:

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.

转载注明原文:ios – NSURLConnection的错误代码“-1009”是什么意思? - 代码日志