Check if a URL takes you to an available destination - iPad
In my iPad app, I am creating an NSURLConnection, and when a valid URL is provided, then I can read the returned data from the host. However, when I put in an invalid URL, the app crashes when I try to make the request.
What is the easiest way to determine if a URL is pointing to a host that can be acces开发者_如何学编程sed?
I saw that Apple has a reachability tutorial, but that does not allow you to check if a specific host can be reached.
Thanks.
NSURLConnection delegate methods:
-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
NSLog(@"ERROR with theConenction");
[connection release];
}
精彩评论