I use this method to check connection:
- (BOOL)networkConnection {
return [[Reachability reachabilityWithHostName:@"http://medsolutions.ru"] currentReachabilityStatus];
}
Its all work in simulator, and on iPhone 6, but not work with iPhone 4S. I mean, block:
if (!([self networkConnection] == NotReachable)){
Always return false, which means that there is no connection, but actually it is connected via wi-fi.
I am checking rechability in one of my projects something like,
if ([[Reachability reachabilityForInternetConnection]currentReachabilityStatus]==NotReachable)
{
NSLog(@"not available");
}
else{
NSLog(@"available");
}
if you want to check particular host then,
if ([[Reachability reachabilityWithHostName:@"http://medsolutions.ru"]currentReachabilityStatus] == NotReachable) {
NSLog(@"not available");
}
else{
NSLog(@"available");
}
Hope this will help :)