Check Internet Connection in iphone

Check internet connection is available or not in iphone
- (BOOL)connectedToInternet
{
    NSString *URLString = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://iphonecodeapps.blogspot.com/"]];
    return (URLString != NULL ) ? YES : NO;
}


if ([self connectedToInternet]) 


{
     NSLog(@"Connected");
}
else
{
    NSLog(@"Not Connected");
}

Powered by Blogger.
Twitter Delicious Facebook Digg Stumbleupon Favorites More