Once you have downloaded and imported Reachbility.m
and Reachbility.h
files
create a helper function:
-(BOOL)IsConnected{
Reachability *reachability = [Reachability reachabilityForInternetConnection];
NetworkStatus networkStatus = [reachability currentReachabilityStatus];
return !(networkStatus == NotReachable);
}
Then use it
if([self IsConnected]){
[self retrieveData];
}
else{
//not connected to internet!
}