Jeff Kranenburg Jeff Kranenburg - 2 months ago 15
iOS Question

iOS Detect 3G or WiFi

I am not sure if this is possible, but I have this scenario.

I have a website displayed in my UIWebView which has the link set in a UISegmentedController.
They website can detect if you are on wifi or on the 3g network.

Now The segmented controller points to 2 different pages.
1 - an iPhone friendly login screen
2 - the home page, once you are logged in.

Now this is the question:

Can I program my application to detect if it is on wifi or 3g (I know you can do this), but then based on the answer go to segment 1 or 2

Kind like this:

if(iPhone device is on 3g) {
Go to Segment 1;
} else {
Go to Segment 0;


Using the code apple provide here

Reachability *reachability = [Reachability reachabilityForInternetConnection];
[reachability startNotifier];

NetworkStatus status = [reachability currentReachabilityStatus];

if(status == NotReachable) 
    //No internet
else if (status == ReachableViaWiFi)
else if (status == ReachableViaWWAN)