Step 3: Create the below function
- (BOOL)checkNetConnection {
self.internetReachability = [Reachability reachabilityForInternetConnection];
[self.internetReachability startNotifier];
NetworkStatus netStatus = [self.internetReachability currentReachabilityStatus];
switch (netStatus) {
case NotReachable:
{
return NO;
}
case ReachableViaWWAN:
{
return YES;
}
case ReachableViaWiFi:
{
return YES;
}
}
}
Step 4: Call the function as below:
if (![self checkNetConnection]) {
[GlobalFunctions showAlert:@""
message:@"Please connect to the Internet!"
canBtntitle:nil
otherBtnTitle:@"Ok"];
return;
}
else
{
Log.v("internet is connected","ok");
}