Follow following 3 easy steps –
Step 1: Include “SystemConfiguration.framework” framework in your project
Step 2: Included Apple’s Reachability.h and Reachability.m from Reachability example
Step 3: Now add this code anywhere in your .m.
Reachability* wifiReach = [[Reachability reachabilityWithHostName: @"www.apple.com"] retain];
NetworkStatus netStatus = [wifiReach currentReachabilityStatus];
switch (netStatus)
{
case NotReachable:
{
NSLog(@"Access Not Available");
break;
}
case ReachableViaWWAN:
{
NSLog(@"Reachable WWAN");
break;
}
case ReachableViaWiFi:
{
NSLog(@"Reachable WiFi");
break;
}
}