VíctorVarLed
VíctorVarLed

Reputation: 148

Is it possible to switch between WiFi and 3G in my iOS app?

I am working on an iOS app that gets connected to a local WiFi network without Internet access.

In the main screen of my app I want to show the option to post a message in Twitter or Facebook.

Is it possible to switch to a 3G connection to send the tweet or delay the message until there is an active Internet connection ??

Thanks!

Upvotes: 0

Views: 570

Answers (2)

Renish Dadhaniya
Renish Dadhaniya

Reputation: 10752

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

NetworkStatus status = [reachability currentReachabilityStatus];

if(status == NotReachable) 
{
    //No internet
}
else if (status == ReachableViaWiFi)
{
    //WiFi
}
else if (status == ReachableViaWWAN) 
{
    //3G
}

it's differentiate the network status.

Upvotes: 1

Kamaros
Kamaros

Reputation: 4566

Take a look at the Apple Reachability library: https://developer.apple.com/library/ios/samplecode/reachability/Introduction/Intro.html

Upvotes: 0

Related Questions