Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if user is connected to wifi or cellular

I know for previous version of iOS, you would use the Reachability framework by apple. But if I remember correctly in iOS 7 or iOS 8 there was a new way to check if a user was connected to wifi or cellular. I would like to check to know if I load fancy videos or just poster images. Or even for later iOS versions you need to still use Reachability?

like image 349
DemosJarco Avatar asked Dec 03 '25 09:12

DemosJarco


1 Answers

 -(void)isNetworkReachable
 {
        NetworkStatus remoteHostStatus = [[Reachability  reachabilityForInternetConnection] currentReachabilityStatus];
        if (remoteHostStatus == ReachableViaWWAN){
            NSLog(@"LAN/WAN network....");
        }
        else if (remoteHostStatus == ReachableViaWiFi){
            NSLog(@"Wifi network....");
        }
 }
like image 83
kb920 Avatar answered Dec 05 '25 01:12

kb920



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!