iOS Launching Settings -> Restrictions URL Scheme

122,097

Solution 1

AS @Nix Wang's ANSWER THIS IS NOT WORK IN IOS 10


WARNING: This method will not work for devices running iOS 5.1 and greater - See Hlung's comment below.

It's possible that the path component has a different name than the actual section, but it's also possible that you can't currently access that section straight from a URL. I found a list of possible URLs and Restrictions is not on it, maybe it's just not found out yet.

List of currently known URLs in the Settings app:

  • prefs:root=General&path=About
  • prefs:root=General&path=ACCESSIBILITY
  • prefs:root=AIRPLANE_MODE
  • prefs:root=General&path=AUTOLOCK
  • prefs:root=General&path=USAGE/CELLULAR_USAGE
  • prefs:root=Brightness
  • prefs:root=General&path=Bluetooth
  • prefs:root=General&path=DATE_AND_TIME
  • prefs:root=FACETIME
  • prefs:root=General
  • prefs:root=General&path=Keyboard
  • prefs:root=CASTLE
  • prefs:root=CASTLE&path=STORAGE_AND_BACKUP
  • prefs:root=General&path=INTERNATIONAL
  • prefs:root=LOCATION_SERVICES
  • prefs:root=ACCOUNT_SETTINGS
  • prefs:root=MUSIC
  • prefs:root=MUSIC&path=EQ
  • prefs:root=MUSIC&path=VolumeLimit
  • prefs:root=General&path=Network
  • prefs:root=NIKE_PLUS_IPOD
  • prefs:root=NOTES
  • prefs:root=NOTIFICATIONS_ID
  • prefs:root=Phone
  • prefs:root=Photos
  • prefs:root=General&path=ManagedConfigurationList
  • prefs:root=General&path=Reset
  • prefs:root=Sounds&path=Ringtone
  • prefs:root=Safari
  • prefs:root=General&path=Assistant
  • prefs:root=Sounds
  • prefs:root=General&path=SOFTWARE_UPDATE_LINK
  • prefs:root=STORE
  • prefs:root=TWITTER
  • prefs:root=General&path=USAGE
  • prefs:root=VIDEO
  • prefs:root=General&path=Network/VPN
  • prefs:root=Wallpaper
  • prefs:root=WIFI
  • prefs:root=INTERNET_TETHERING

Solution 2

As of iOS8 you can open the built-in Settings app with:

NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
   [[UIApplication sharedApplication] openURL:url];
}

The actual URL string is @"app-settings:". I tried appending different sections to the string ("Bluetooth", "GENERAL", etc.) but seems only linking to the main Settings screen works. Post a reply if you find out otherwise.

Solution 3

If you add the prefs URL scheme to your iOS app, it will allow you to use all those schemes that we could in iOS 5. I've tested it on iOS 9, but I think it will work on older versions too.

Solution 4

Update:

prefs: will NOT work since iOS 10.

Solution 5

Yep, saw this (and many more), even implemented it in a test application. Really need to get the definitive word from Apple, but the community consensus opinion is Apple disallowed it in 5.1 after it was publicly "discovered/published", so applications containing it won't be accepted.

08/01/12 Update: Asked Apple through my developer account if there is a way to programmatically launch the WiFi Settings dialog. Here is the response:

"Our engineers have reviewed your request and have concluded that there is no supported way to achieve the desired functionality given the currently shipping system configurations."

Share:
122,097
kturner
Author by

kturner

Updated on October 08, 2020

Comments

  • kturner
    kturner over 3 years

    I've recently discovered the awesome iOS5 custom Settings URL Scheme, which can be explained in detail at this great website.

    I've found this to work, directing the user to the Settings app from my application:

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

    But cannot seem to route directly to the Restrictions path via the path parameter:

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

    Has anyone found documentation on this or been able to make this work?

    Any insight would be greatly appreciated. I'm trying to take the user to enable in-App purchasing, and would rather not have the user manually click on Restrictions (not very obvious).

  • kturner
    kturner over 12 years
    Henri, thanks for your prompt response. This is a much more verbose listing of url schemes for Settings that I was able to find. I'll be sure to do some research and post back if I can find anything specifically regarding the "Restrictions" path. Cheers!
  • Henri Normak
    Henri Normak over 12 years
    No problem, if you end with the same list as I did, make sure to mark my answer as accepted to let others also know.
  • bsarrazin
    bsarrazin over 12 years
    Is there any official documentation on this?
  • Henri Normak
    Henri Normak over 12 years
    Didn't find any about the available URLs, only about how the URLs work. This list is put together from different sites.
  • Henri Normak
    Henri Normak over 12 years
    Of course, as URL schemes for the Settings app were introduced with iOS 5, thanks for the heads up!
  • Nik Burns
    Nik Burns over 12 years
    github.com/Burnsoft/Settings-Swipe an open source project I added to github may be of interest to those looking for shortcuts to settings. Nik
  • Nik Burns
    Nik Burns over 12 years
    Worth noting that apple will reject any apps that use or make reference to the prefs URL scheme.
  • Niklas
    Niklas over 12 years
    @NikBurns do you have any reference for that?
  • Nik Burns
    Nik Burns over 12 years
    only from experience with AppStore review process. rdar://5864941 if you want to dupe it.
  • Jonathan Vaught
    Jonathan Vaught over 12 years
    Has anyone come across the URL for the Mail, Contacts, Calendar | Fetch New Data settings?
  • Hlung
    Hlung about 12 years
    Just a kind warning, idownloadblog.com/2011/11/29/iphone-5-1-disables-shortcuts said that all url schemes to iOS settings will be removed in iOS5.1 (so urls like prefs:root=General&path=Network will no longer work) So, please aware.
  • zambono
    zambono almost 12 years
    They are not completely removed you just have to put these URL links in a button in an UIAlertView. So simply put a warning in the UIAlertView that the app will go to background and settings will open and then OK, and Cancel etc.
  • Chris
    Chris almost 12 years
    @zambono Can you confirm this is working and apps are being approved/functioning properly across a variety of devices and iOS versions?
  • zambono
    zambono almost 12 years
    It's no longer working, it was working on one of my apps a while back but not anymore.
  • Matt Connolly
    Matt Connolly about 11 years
    I recommend anyone who needs this feature to log an official bug report. The more it is reported, the more it will be visible and a better chance that a supported solution may be presented in the future. bugreport.apple.com
  • Jason Moore
    Jason Moore over 9 years
    As of iOS8 you can launch the built-in Settings app with the url: [NSURL URLWithString:UIApplicationOpenSettingsURLString]
  • JAL
    JAL over 9 years
    That's because that particular call is the Settings Launch URL. It opens the app's custom settings if they exist. If not, it just opens the Settings app to the main screen. developer.apple.com/library/ios/documentation/UIKit/Referenc‌​e/…
  • Henri Normak
    Henri Normak over 9 years
    It is worth noting that the last snippet takes you to the app specific privacy settings and not just the settings app.
  • AmineG
    AmineG over 9 years
    @JasonMoore is there a way to open this settings using a link (using HTML/JS) ?
  • kyleturner
    kyleturner over 9 years
    Fantastic answer if your app has specific settings you want enabled/disabled. All in one place and don't have to navigate the user through Settings to get to desired configuration. Thanks!
  • Valeriy Van
    Valeriy Van almost 9 years
    This trick only works starting iOS 8 where there's no need for it.
  • Pedro Tôrres
    Pedro Tôrres almost 9 years
    But same in iOS 8 you are not allowed to open WiFi settings, for example, if you don't add this URL shame to your application.
  • Valeriy Van
    Valeriy Van almost 9 years
    Yes, you are right. Didn't think about this use case.
  • Kevin Sylvestre
    Kevin Sylvestre over 8 years
    @conorgriffin For you and anyone else wondering the setting lives under: Targets | (Application) | Info | URL Types | +
  • Jamie McDaniel
    Jamie McDaniel over 8 years
    I just noticed this in the PopKey app. I tried the url for Settings > Wi-Fi settings and it works as well. Let's hope this remains.
  • Warpling
    Warpling over 8 years
    Do these schemes need to be added to LSApplicationQueriesSchemes in info.plist?
  • Mikhail
    Mikhail over 8 years
    No, they don't. Just use its with openURL: method.
  • Randy H.
    Randy H. over 8 years
    I am trying to use this to link to settings from a web page and it appears to work in Safari on an iPhone but not an iPad. Both are on 9.0.2. Seriously, Apple?
  • Mikhail
    Mikhail over 8 years
    Thanks for comment. I'll also try to check this case and respond you.
  • shim
    shim over 8 years
    Still needed to add prefs URL scheme to target
  • Aral Balkan
    Aral Balkan over 8 years
    This works in the simulator for me but not on the device. iOS 9.1.
  • Mikhail
    Mikhail over 8 years
    Well, it's very strange because I've checked this feature right now on my iPhone 5S with iOS 9.1 onboard, and it works as usual.
  • rmaddy
    rmaddy over 8 years
    This doesn't work for me on an 5th gen iPod touch running iOS 9.0.2. I added prefs to LSApplicationQueriesSchemes and canOpenURL: returns NO for any URL starting with prefs:. And openURL: does nothing.
  • Gautam Sareriya
    Gautam Sareriya over 8 years
    Hi Mikhail Gasaonov, I have tried it in iOS 9.1 as per your post but its not working... [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=TWITTER"]];
  • Ryan Brodie
    Ryan Brodie over 8 years
    Did you ever get this working again? Such a shame if not!
  • Kaiyuan Xu
    Kaiyuan Xu over 8 years
    @RyanBrodie What do you mean by "such a shame"?
  • Ryan Brodie
    Ryan Brodie over 8 years
    That it's very unfortunate, would be great to link directly into Safari's Content Blocker settings
  • Kaiyuan Xu
    Kaiyuan Xu over 8 years
    @RyanBrodie Even if it could works, I suggest you don't use it for App Store Apps right now, I just got a "rejected" from iTunes Connect this morning, for "prefs:root" is a private API ( there are apps using prefs:root on App Store ... God know why)
  • Ryan Brodie
    Ryan Brodie over 8 years
    I didn't realise that thank you very much for the heads up!
  • Nate
    Nate over 8 years
    This is because the Bluetooth menu has been moved around in recent iOS versions. It's now a top-level setting, not under General.
  • daspianist
    daspianist over 8 years
    This code works fine on iPhone 5, 5S, 6 and 6 Plus (with iOS 9+), but not on the latest iPhone 6S and 6S Plus.
  • Michael Dorner
    Michael Dorner over 8 years
    @Imran: You forgot the prefs-stuff.
  • Hlung
    Hlung about 8 years
    Someone said he got rejected for using "prefs:root" url. stackoverflow.com/questions/8246070/…
  • guyromb
    guyromb almost 8 years
    This was re-added in iOS 9. Check: stackoverflow.com/questions/37399893/…
  • ShayanK
    ShayanK almost 8 years
    @FabianKöbel were you able to find one for TouchID & Passcode?
  • Fabian Köbel
    Fabian Köbel almost 8 years
    @AspersionCast : you can use this: prefs:root=TOUCHID_PASSCODE (stackoverflow.com/questions/35410746/…)
  • werediver
    werediver almost 8 years
    Here in the comments people say this cause rejection on review process.
  • Jamie McDaniel
    Jamie McDaniel almost 8 years
    We have been using this successfully to link to Wi-Fi settings and have been accepted into the App Store twice. Unfortunately, it is no longer working with iOS 10 Beta 1.
  • KoreanXcodeWorker
    KoreanXcodeWorker almost 8 years
    @FabianKöbel The url for Touch ID & Passcode is 'TOUCHID_PASSCODE' (stackoverflow.com/a/35411090/4493512) , but not sure if this is not to be rejected when publishing.
  • Fabian Köbel
    Fabian Köbel almost 8 years
    @MaggiePhillips thank you. We've already launched apps with this, it was no reason to reject them.
  • KoreanXcodeWorker
    KoreanXcodeWorker almost 8 years
    @FabianKöbel Ow, did you succeed in launching your app using 'prefs:root=TOUCHED_PASSCODE' ?? then I will right away use it.
  • Fabian Köbel
    Fabian Köbel almost 8 years
    @MaggiePhillips yes, these apps are already available in the App Store. It was no problem.
  • Abhishek Thapliyal
    Abhishek Thapliyal almost 8 years
    Working fine in iOS 9.2.3 Check URL Scheme : stackoverflow.com/questions/5655674/…
  • OXXY
    OXXY over 7 years
    What's the alternative ?
  • daspianist
    daspianist over 7 years
    That's crazy, since this official Apple Doc (developer.apple.com/library/ios/qa/qa1924/_index.html) purposely addressees the prefs issue, and dated 8/2/2016.
  • Peter Johnson
    Peter Johnson over 7 years
    That doc does say only to use it for keyboard settings (anything other than that specific use is a violation.)
  • Shreyank
    Shreyank over 7 years
    i am using this [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=DO_NOT_DISTURB"]]; for open DND Setting of device. Apple will reject this ?
  • Igoussam
    Igoussam over 7 years
    Unfortunately it doesn't seem to work even for keyboard settings in iOS 10.
  • shim
    shim over 7 years
    Is there a reason why they removed it? Or is it a bug? If so, should report it as a bug to Apple
  • ranjit.x.singh
    ranjit.x.singh over 7 years
    Any solution/alternative for ios10 please.
  • luky
    luky over 7 years
    hey, it is true that this doesn't work anymore on iOS10 but what is funny is, that apps like google maps / apple maps when you disable location services in settings and try to call the function "navigate" in these apps, both apps are able to open settings / location services even on iOS 10 :).. hackers, or i don't know (no wonder in case of apple app, but in case of google maps..)
  • Gunja Patel
    Gunja Patel over 7 years
    @ Nix Wang , Any other method or alternative possible for prefs: in iOS 10.
  • Ahmet Akkök
    Ahmet Akkök over 7 years
    Had it only passed the review or does it also works? I mean does the openURL takes you to settings? It did not work on my side.
  • daspianist
    daspianist over 7 years
    While prefs: no longer work, the following does (at least in opening general): App-Prefs::root=Settings&path=General
  • Stas
    Stas about 7 years
    Is this legit? Successful app submission doesn't mean that this is legit. It may fail eventually in the future..
  • Stas
    Stas about 7 years
    Is this legit? Successful app submission doesn't mean that this is legit. It may fail eventually in the future.. is there any proofs?..can't find..
  • Henri Normak
    Henri Normak about 7 years
    Almost all of these are undocumented, thus should not really be used without being ready for them to break.
  • Ansari
    Ansari about 7 years
    Working if you change prefs to App-prefs, like: App-prefs:root=CASTLE&path=STORAGE_AND_BACKUP But is this legal ?
  • Umair Aamir
    Umair Aamir about 7 years
    App-Prefs:root=Bluetooth is working for me in iOS 10 but I am not sure, it is legit or not
  • Michael Garito
    Michael Garito almost 7 years
    App-Prefs:root=GAMECENTER is working on 10.3.3 (14G60) [updated today]
  • Genevios
    Genevios almost 7 years
    @MichaelGarito Yes man! It's really working perfectly! Thanks you are save my time!
  • Sasho
    Sasho almost 7 years
    iOS 10, Location Services shortcut = App-Prefs:root=Privacy&path=LOCATION
  • myaug
    myaug over 6 years
    "App-Prefs:root=TOUCHID_PASSCODE" doesn't work on iOS 11. Any other solution?
  • Tejas K
    Tejas K almost 6 years
    App-Prefs is a private API which will lead to app rejection during review.
  • Tejas K
    Tejas K almost 6 years
    @Stas : No, it's not, since it is a private API.
  • u2Fan
    u2Fan over 5 years
    This appears to be the only currently-Apple-approved method to launch the Settings app.
  • ergunkocak
    ergunkocak about 5 years
    Nope Apple rejected our app because of this "prefs:"
  • Naresh
    Naresh almost 4 years
    Alternative is App-Prefs: from iOS 10 on wards.
  • palmi
    palmi over 2 years
    > Important: The prefs: URL scheme is undocumented. Its use, except in the specific case described in this document, is a violation of the iOS App Review Guidelines and may result in the rejection of your app. You may only use the specific URL scheme in Listing 1 to open the Keyboard settings, and only from a custom keyboard extension. It may not be used by any other type of app, nor to open any other Settings. developer.apple.com/library/archive/qa/qa1924/_index.html
  • palmi
    palmi over 2 years
    > Important: The prefs: URL scheme is undocumented. Its use, except in the specific case described in this document, is a violation of the iOS App Review Guidelines and may result in the rejection of your app. You may only use the specific URL scheme in Listing 1 to open the Keyboard settings, and only from a custom keyboard extension. It may not be used by any other type of app, nor to open any other Settings. developer.apple.com/library/archive/qa/qa1924/_index.html
  • palmi
    palmi over 2 years
    > Important: The prefs: URL scheme is undocumented. Its use, except in the specific case described in this document, is a violation of the iOS App Review Guidelines and may result in the rejection of your app. You may only use the specific URL scheme in Listing 1 to open the Keyboard settings, and only from a custom keyboard extension. It may not be used by any other type of app, nor to open any other Settings. developer.apple.com/library/archive/qa/qa1924/_index.html
  • palmi
    palmi over 2 years
    > Important: The prefs: URL scheme is undocumented. Its use, except in the specific case described in this document, is a violation of the iOS App Review Guidelines and may result in the rejection of your app. You may only use the specific URL scheme in Listing 1 to open the Keyboard settings, and only from a custom keyboard extension. It may not be used by any other type of app, nor to open any other Settings. developer.apple.com/library/archive/qa/qa1924/_index.html