0

I know that on Android there is an API to specify which network bearer to use (WiFi vs cellular vs VPN).

Does iOS have an equivalent facility/API/capability? I checked the documentation but it seems that it such API is not publicly available.

Undo
  • 25,519
  • 37
  • 106
  • 129
user3342339
  • 349
  • 1
  • 5
  • 19

1 Answers1

1

No, there isn't any way for an iOS app to select which type of network data is sent over. The sandbox keeps you from doing that.

If it's a problem like you're downloading a large file and don't want to do it over a user's cellular data connection (as a user, thank you!), you could use Apple's Reachability class to see what the current data connection is. This other answer shows how to do that:

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
}
Community
  • 1
  • 1
Undo
  • 25,519
  • 37
  • 106
  • 129