Search code examples
wifidetect3g

How to detect wheter running on 3G or Wi-Fi on iPhone?


Some lines of code? Any experience?


Solution

  • Since than I made a pretty simple block based Reachability wrapper that strips all the outdated C-like Reachability code, poured into a much more Cocoa form.

    Usage like:

    [EPPZReachability reachHost:hostNameOrIPaddress
                   completition:^(EPPZReachability *reachability)
    {
        if (reachability.reachableViaCellular) [self doSomeLightweightStuff];
    }];
    

    See Reachability with blocks for everyday use at eppz!blog, or grab it directly from eppz!reachability at GitHub.

    It also works with IP addresses, which turned out to be a pretty rare Reachability wrapper feature.