Use only WiFi connection (not cellular network) in app?

My app has been rejected in the Apple app-store.

To fix this, it must use only WiFi and not cellular network connection when the user is using the application. The application uses UIWebView -- how can we go about implementing this restriction?

Any help will be appreciated, Thanks!

Answers


Take a look at the Reachability example from Apple.

With that, you can query the device about the current network status, so you can know if Wifi is available, or if a connection will need cellular network. In the last case, you may display an alert, and prevent your UIWebView to load the data.

EDIT

If you have imported the reachability class into your project, and added the required framework(s), here's an example. This will test for an available WiFi connection:

Reachability * reach;
NetworkStatus  status;

reachability = [ Reachability reachabilityForLocalWiFi ];
status       = [ reach currentReachabilityStatus ];

if( status == ReachableViaWiFi )
{
    /* Hurray, you've got a WiFi connection! */
}
else
{
    /* No WiFi connection - Alert the user! */
}

Need Your Help

Running xgettext or creating .pot files without shell access?

php shell gettext shared

I've been reading and reading about using gettext to internationalise a PHP website and it is interesting to me.

strange characters in packets

c http networking pcap

I'm writing a sniffer for http packets with libpcap.