I use NSURLConnection's sendSynchronousRequest:returningResponse:error: method (in a separate NSOperation thread) to connect to external server to retreive data. How do I know if the operation ended timed out, or some other network error?
I use NSURLConnection’s sendSynchronousRequest:returningResponse:error: method (in a separate NSOperation thread) to connect to external
Share
If there was an error, the error parameter will be non-nil when
sendSynchronousRequest:returningResponse:error:returns.You can retrieve the error code by checking the value returned by
[NSError code]. The error code for time out isNSURLErrorTimedOut.For instance: