Question

Is it possible to restrict an iPhone app to only work if there's a Wifi connection (not 3G)?

Was it helpful?

Solution

Yes. There are two steps:

First, you need to add the UIRequiresPersistentWiFi key to your applications Info.plist. This ensures that the WiFi connection does not go to sleep while your application is open.

Secondly, you need to query the system (using the SCNetworkReachability API) to see which radio is currently enabled. See this question in the iPhone documentation.

OTHER TIPS

You can also get the Reachability class from Reachability sample from apple dev center. It offers a way to check how the iphone is connected.

Networking and Internet how-to's

If your application requires WiFi, you need to add the UIRequiresPersistentWiFi key to Info.plist and set it True. This key notifies the system that your application uses the WiFi network for communication.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top