I'm doing some network requests using [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:completionHandler]
.
Unfortunately, half the time I perform these requests, I get an NSError
with A server with the specified hostname could not be found
. I also get Request timed out
some of the time, but less frequently.
I'm in a basement, so it could just be an issue with network connectivity, but I'm able to send requests just fine with other apps. I'm also able to load the URL just fine in safari and speed tests seem fine.
Requests are sent to over http
. There are also times when 2 or 3 requests may be sent at the same time.
My questions:
- Does
sendAsynchronousRequest
do anything significantly different from the delegate basedNSURLRequest
methods that would be causing this behavior? - If not, are there preferred ways of gracefully handling these errors? I've tried just retrying the request up to a limit, but they all result in the error. I've thought about setting a delay between retries, but it doesn't seem to make a difference.