[Objective-C] Network type (WIFI, 3G, EDGE/GPRS)

Using private Framework, in particular SoftwareUpdateServices.frameworkyou can distinguish between carrier network, in particular, if your connection is 3G or GPRS/EDGE, or WiFi.

Private API headers


SUNetworkMonitor Class


How to?

You need include your framework. Note that you cannot include it from Xcode, but need to be loaded via code.

// load framework dinamicall from bundle
NSBundle *b =
[NSBundle bundleWithPath:

if ( [b load] )
    // load Class from STRING
    Class NetworkMonitor = NSClassFromString(@"SUNetworkMonitor");
    // alloc class
    if ( !_NetPointer ) _NetPointer = [[NetworkMonitor alloc] init];

    // check if the class have the method currentNetworkType
    if ( [_NetPointer respondsToSelector:@selector(currentNetworkType)] )
        int t = (int)[_NetPointer performSelector:@selector(currentNetworkType)];

        NSString *type = @"";
        switch ( t ) {
            case 0:  type = @"NO-DATA"; break;
            case 1:  type = @"WIFI"; break;
            case 2:  type = @"GPRS/EDGE"; break;
            case 3:  type = @"3G"; break;
            default: type = @"OTHERS"; break;

    NSLog(@"Network type: %@", type);

You can use also dlopen to load dinamically libs or frameworks on your code, in this way:

void *libHandle =
dlopen("/System/Library/PrivateFrameworks/SoftwareUpdateServices.framework/SUNetworkMonitor", RTLD_LAZY);


This is a undocumented use of private API.
Your app will be rejected from App Store if use this way.
I suggest to use only for personal test or cydia store.

Rif: albertopasca.it
Rif: stackoverflow.com


Alberto Pasca

Software engineer @ Pirelli & C. S.p.A. with a strong passion for mobile  development, security, and connected things.