2

How to check in my iOS app if my cellullar data are turned off, and show this alert to navigate to it on settings and turn it on.

For example check the image!

enter image description here

E-Riddie
  • 14,660
  • 7
  • 52
  • 74

2 Answers2

1

Apple has some sample code available named Reachability which you can use to see if the Internet is available.

If WiFi is down, you can bring up your own "You can turn on cellular data for this app" UIAlertView.

Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
  • I know about rechability, I have used it in my project but I dont know how to show that alert view which sends me to settings and cellullar data. I mean what kind of method should I use to go to settings? – E-Riddie Feb 02 '14 at 12:37
  • 1
    You might not be able to go directly to the settings from your own app. [See this related question about getting into Settings from your own app](http://stackoverflow.com/questions/5655674/opening-the-settings-app-from-another-app). – Michael Dautermann Feb 02 '14 at 12:40
  • So this means that I can not go to settings in later versions than 5.0? That means apple has integrated only on safari that kind of algorithm? – E-Riddie Feb 02 '14 at 12:49
  • 1
    Safari is Apple's own app, so they can do what they want. Everybody else only gets to do what is allowed per the guidelines. – Michael Dautermann Feb 02 '14 at 12:51
1

Well, iOS 5.1 removed the ability to open Settings, so basically you can't do it in iOS >= 5.1

for iOS < 5.1 was something like that

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General&path=Network"]]
Daniele
  • 2,461
  • 21
  • 16