I am developing a web-based application where I need to launch the application only when my server is up for a particular host. If the network connection is not available I am planning to show an alertview to re-launch the application. I am using this:
NSURL *scriptUrl = [NSURL URLWithString:@"http://lmsstaging.2xprime.com"];
NSData *data = [NSData dataWithContentsOfURL:scriptUrl];
if (data != nil) {
//Launch my application
}
else {
//show an alert
}
But the problem is that, when I click on the “OK” button in the alert view, I want my application to quit. Is this the right way to do this? Can someone suggest any other option to overcome this scenario?
There is no “official” way to quit. Apple recommends your alert to say something like: “Network connectivity required for this application. Press the home button to quit.”