1

is there a possibilty to check whether the iphone is connected via Wlan, via 3g, via 4g or via 2g?! I know there is a reachability class from apple, but with that you can only check if Wlan or wwan...

switch (netStatus)
{
    case NotReachable:
    {
        statusString = @"Access Not Available";
        imageView.image = [UIImage imageNamed: @"stop-32.png"] ;
        //Minor interface detail- connectionRequired may return yes, even when the host is unreachable.  We cover that up here...
        connectionRequired= NO;  
        break;
    }

    case ReachableViaWWAN:
    {
        statusString = @"Reachable WWAN";
        imageView.image = [UIImage imageNamed: @"WWAN5.png"];
        break;
    }
    case ReachableViaWiFi:
    {
         statusString= @"Reachable WiFi";
        imageView.image = [UIImage imageNamed: @"Airport.png"];
        break;
  }
}
davidOhara
  • 1,008
  • 5
  • 17
  • 39

1 Answers1

0

The cases you're looking to identify belong to the WWAN (Wireless Wide Area Network) case. There's no official documented way to do this, but Here's a solution that might do the trick , using private API on the status bar

Community
  • 1
  • 1
Vinzzz
  • 11,746
  • 5
  • 36
  • 42
  • Wow, that´s great! Ehm, and am i allowed to use private API´s in my Apps when i want to put it in the apple store? – davidOhara Jul 25 '12 at 12:31
  • Nope, that's why they're called private APIs :( – Anshu Chimala Jul 25 '12 at 12:34
  • So there´s no way to put an app into the store with such kind of analysis? – davidOhara Jul 25 '12 at 12:37
  • You can always give it a try... But I guess not! Even the `UIStatusBarDataNetworkItemView` isn't a public class (http://developer.limneos.net/?framework=UIKit.framework&header=UIStatusBarDataNetworkItemView.h) – Vinzzz Jul 25 '12 at 12:47
  • 1
    They are from Apple :'private' means that they don't appear in any *.h (header file) nor any Apple documentation. So People have to come with some techniques to find out about these hidden APIs. The 'limneos' link above goes to a header which isn't from Apple, but was generated by an iOS hacker. – Vinzzz Jul 26 '12 at 14:09