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 here is the question:
Can I program my application to detect whether it is to WIFI or 3G (I know you can do this), but then based on the answer go to segment 1 or 2
Kind of like this:
if (iPhone device is on 3g) {
Go to Segment 1;
} else {
Go to Segment 0;
}
Import Apple's Reachability and try this,
References(Links may broke in future) :
What is the difference between CDMA and WCDMA network sim
What is "EV-DO Rev. A"?
For swift we can use:
Class method is as follow
To check if you are in a wifi, this saves the costly check of making a connection. Check for ifa_name "bridge" to check for internet sharing.
If you don't want to import Reachability library or deal with notifiers, you can use this simple synchronous method:
If you are using Xamarin or Monotouch you can use Reachability adapted class from Xamarin GitHub repository:
https://github.com/xamarin/monotouch-samples/blob/master/ReachabilitySample/reachability.cs
So add it to your project and call
Reachability.InternetConnectionStatus()