I have an application which needs to access both a back-end server and third-party API (Google, Cloudmade etc.) throughout the application. There is no alternative and the connection is needed.
I am already doing a check with Tony Million's version of Reachability , see https://stackoverflow.com/a/3597085/3187198. I do this in the appDelegate, and would like to do something when the network status is NotReachable
.
From a design perspective, I need to handle this, either by letting the user take action or give information, before closing the application. I have considered three scenarios:
A. The user gets an UIAlert, with the possibility to go to network settings via [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=WIFI"]];
but this is both an undocumented functionality and not functioning beyond 5.1
B. Inform the user via UIAlert, with "exit" as confirmation, and then exiting the application with exit(0)
. However, this behaviour is also forbidden and will cause the application to be rejected by Apple.
C. Setting UIRequiresPersistentWiFi = YES
in the AppName-Info.plist, but this is a bit over the top, as it the app do not require consistent wifi/3G, and this will not prompt for missing network if this is the case.
So, my question is, what is the recommended way to handle the NotReachable
case?