5

I've tried using:

[[UIApplication sharedApplication] openURL: [NSURL URLWithString: @ "prefs: root = General & path = Network"]];

And options trading all you see here:

examples

But I can not make it work.

Community
  • 1
  • 1
jose920405
  • 7,982
  • 6
  • 45
  • 71
  • As far as iOS 6 and 7, this can not be done. With iOS 8, it can be done using the following code: [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]; – Mike Aug 29 '14 at 02:15

1 Answers1

29

Apple no longer allows developers to open the Settings application from within their apps (iOS 5.1 and later).

EDIT

According to @Mike's comment below, this can be done in iOS 8+

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];

Using this prior to iOS 8 will result in a crash, however.

rebello95
  • 8,486
  • 5
  • 44
  • 65
  • 1
    This is incorrect, because in iOS 8 this is allowed. – Mike Aug 29 '14 at 02:13
  • 2
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]; is how it is done, although just in case anyone sees this, this will crash if you try to run it in iOS 7 as the const doesn't exist. – Mike Aug 29 '14 at 02:17
  • how would you go back to the app? Can you add a callback? – kevinl Sep 18 '14 at 01:18
  • It is now supported on iOS 9. Check this: http://stackoverflow.com/questions/37399893/open-phone-settings-programmatically-in-ios9 – guyromb May 25 '16 at 13:49
  • This won't open the Settings homepage. Instead, it will open the app settings page (it's the page where users can see/opt-out permissions like GPS, Camera access, notifications etc.) – superpuccio May 15 '19 at 13:39