iosobjective-cios7wifi3g-network

How can i find programmatically iPhone device connected 3G network or Wifi in iOS7


Hi i need to find out whether iPhone internet connected 3G or 2G or WIFI network any suggestions

Thanks

Sravan


Solution

  • Download Reachability Class for iOS from this link:- https://github.com/tonymillion/Reachability

    1)Add Reachability.h &.m in your Project, make sure you make it ARC compatible by adding flag -fno-objc-arc

    2)Now, check the connection type in your view controller

      Reachability *reachability = [Reachability reachabilityForInternetConnection];
        [reachability startNotifier];
    
        NetworkStatus status = [reachability currentReachabilityStatus];
    
        if(status == NotReachable) 
        {
            //No internet
        }
        else if (status == ReachableViaWiFi)
        {
            //WiFi
        }
        else if (status == ReachableViaWWAN) 
        {
            //3G
        }