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");
}

1 comments:

Thanks for sharing nice Code........
-------------------------------------------------------------------------------
iPhone App Development :: && ::Mobile and Web Application Development


Post a Comment

Powered by Blogger.
Twitter Delicious Facebook Digg Stumbleupon Favorites More