Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Restrict iPhone app to Wifi

Tags:

iphone

wifi

3g

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

like image 579
hpique Avatar asked Dec 29 '22 14:12

hpique


1 Answers

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.

like image 167
Stephen Darlington Avatar answered Jan 13 '23 09:01

Stephen Darlington