0

I have seen that there are known apps, such as Twitter and Facebook, that display a "Turn Off Airplane Mode or Use Wi-Fi to Access Data" message within an alert view, with a button that switches to the Settings app, when no network is detected as the app goes foreground. This message is the same in all apps where I saw it, is this alert view a kind of predefined one that you can use? Similar to the one displayed when checking locationServicesEnabled...

I found some posts dealing with this issue some time ago, for example: iOS UIAlertView button to go to Setting App, and it seems (or seemed) to be a way to read the values in the iOS' Settings app, but I couldn't find any of this in the Apple Developer's documentation... is there any public API for accessing those values? Would an app be rejected if accessing them as in the post I linked?

Thanks in advance

Community
  • 1
  • 1
AppsDev
  • 12,319
  • 23
  • 93
  • 186

1 Answers1

0

Till iOS 5.0, you can use the URL scheme to open the Settings App from third-party apps using the URLScheme like:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=WIFI"]];

Unfortunately, iOS 5.1 and iOS 6 not supports this feature.

You can use the Reachability for checking the Wi-Fi state.

For displaying the default alertview when the Wi-fi is off or in AirPlane mode you can use the Application uses Wi-Fi flag in the info.plist

Refer InfoPlistKeyReference for details:

UIRequiresPersistentWiFi

“Application uses Wi-Fi”

Specifies whether this app requires a Wi-Fi connection.

Midhun MP
  • 103,496
  • 31
  • 153
  • 200
  • Thanks! So, there is no way to access the rest of the Settings fields in iOS 5+? – AppsDev May 06 '13 at 13:33
  • @AppsDev: For checking the location service, etc. It can be done via code. But you can't open the settings app, or change the value by code – Midhun MP May 06 '13 at 17:16