开发者

Check if a URL takes you to an available destination - iPad

开发者 https://www.devze.com 2023-02-08 15:55 出处:网络
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

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];
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号