You have to use Reachability classes provide by apple.You can download the Reachabaility files from below link
Reachability.h
Reachability.m
Add above two files to your project and then add SystemConfiguration
framework
Now go to the class where you want to check for internet availability and import Reachability file
#import “Reachability.h”
To check for interent connection you can use given below code
-(void)CheckForInternet
{
Reachability *reachability = [Reachability reachabilityForInternetConnection];
NetworkStatus internetStatus = [reachability currentReachabilityStatus];
if (internetStatus == NotReachable) {
UIAlertView *networkAlert = [[UIAlertView alloc]initWithTitle:@”Sorry!” message:@”Unable to connect with servernPlease try again later….” delegate:self cancelButtonTitle:@”OK” otherButtonTitles:nil];
[networkAlert show];
[networkAlert release];
return FALSE;
}
else
{
//available internet connection
}
}