You could also check the reachability as
NSInteger reachabilityStatus = 0;
reachabilityStatus = [self checkNetworkReachability];
if (reachabilityStatus) {
//network is available so perform network oriented task;
} else {
// show an alert saying network is unavailable;
}
- (NSInteger)checkNetworkReachability {
networkReachability = [Reachability reachabilityForInternetConnection];
NetworkStatus networkStatus = [networkReachability currentReachabilityStatus];
if (networkStatus == NotReachable) {
NSLog(@"There IS NO internet connection");
} else {
NSLog(@"There IS internet connection");
}
return (NSInteger)networkStatus;
}