Assuming that I actually have an internet connection, I’ use this code to know if the device is connected via WiFi or not :
+ (BOOL)hasWiFiConnection {
Reachability *reachability = [Reachability reachabilityForInternetConnection];
[reachability startNotifier];
NetworkStatus status = [reachability currentReachabilityStatus];
if (status == ReachableViaWiFi) {
return YES;
} else {
return NO;
}
}
Is that code fast to run?
I’m using it when generating URLs for pictures (so that I know if I load high or low resolution pictures). Those pictures are displayed in a list view (3 per line). When the I scroll the list the function is called several times per second. Is that efficient?
if u dont want to use reachability Class use the following code.
Implementation
use the bool method with class shared Instance were ever you want