86

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).

mmmmmm
  • 30,723
  • 26
  • 85
  • 109
kturner
  • 1,091
  • 2
  • 10
  • 15

13 Answers13

144

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
Dhaval Parmar
  • 18,175
  • 7
  • 77
  • 170
Henri Normak
  • 4,635
  • 2
  • 21
  • 33
  • 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! – kturner Nov 24 '11 at 05:57
  • 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. – Henri Normak Nov 24 '11 at 09:14
  • Is there any official documentation on this? – bsarrazin Dec 20 '11 at 19:05
  • Didn't find any about the available URLs, only about how the URLs work. This list is put together from different sites. – Henri Normak Dec 22 '11 at 09:57
  • Of course, as URL schemes for the Settings app were introduced with iOS 5, thanks for the heads up! – Henri Normak Jan 06 '12 at 12:57
  • https://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 Feb 01 '12 at 14:48
  • Worth noting that apple will reject any apps that use or make reference to the prefs URL scheme. – Nik Burns Feb 01 '12 at 14:51
  • 1
    @NikBurns do you have any reference for that? – Niklas Feb 06 '12 at 12:42
  • only from experience with AppStore review process. rdar://5864941 if you want to dupe it. – Nik Burns Feb 06 '12 at 21:52
  • Has anyone come across the URL for the `Mail, Contacts, Calendar | Fetch New Data` settings? – Jonathan Vaught Feb 09 '12 at 12:43
  • 54
    Just a kind warning, http://www.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. – Hlung Feb 23 '12 at 16:44
  • 3
    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. – zambono May 27 '12 at 12:11
  • @zambono Can you confirm this is working and apps are being approved/functioning properly across a variety of devices and iOS versions? – Chris Jun 15 '12 at 01:17
  • 4
    It's no longer working, it was working on one of my apps a while back but not anymore. – zambono Jul 03 '12 at 22:28
  • 5
    As of iOS8 you can launch the built-in Settings app with the url: `[NSURL URLWithString:UIApplicationOpenSettingsURLString]` – Jason Moore Sep 30 '14 at 19:21
  • 1
    It is worth noting that the last snippet takes you to the app specific privacy settings and not just the settings app. – Henri Normak Oct 01 '14 at 06:46
  • @JasonMoore is there a way to open this settings using a link (using HTML/JS) ? – AmineG Nov 03 '14 at 13:15
  • This was re-added in iOS 9. Check: http://stackoverflow.com/questions/37399893/open-phone-settings-programmatically-in-ios9 – guyromb May 25 '16 at 13:48
  • @FabianKöbel The url for Touch ID & Passcode is 'TOUCHID_PASSCODE' (http://stackoverflow.com/a/35411090/4493512) , but not sure if this is not to be rejected when publishing. – KoreanXcodeWorker Jun 27 '16 at 05:38
  • @MaggiePhillips thank you. We've already launched apps with this, it was no reason to reject them. – Fabian Köbel Jun 27 '16 at 05:43
  • @FabianKöbel Ow, did you succeed in launching your app using 'prefs:root=TOUCHED_PASSCODE' ?? then I will right away use it. – KoreanXcodeWorker Jun 27 '16 at 06:06
  • @MaggiePhillips yes, these apps are already available in the App Store. It was no problem. – Fabian Köbel Jun 27 '16 at 13:36
  • Working fine in iOS 9.2.3 Check URL Scheme : http://stackoverflow.com/questions/5655674/opening-the-settings-app-from-another-app – Abhishek Thapliyal Aug 17 '16 at 16:17
  • 2
    Any solution/alternative for ios10 please. – ranjit.x.singh Sep 27 '16 at 12:28
  • 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.. – Stas Mar 23 '17 at 07:36
  • Almost all of these are undocumented, thus should not really be used without being ready for them to break. – Henri Normak Mar 25 '17 at 07:37
  • Working if you change prefs to App-prefs, like: App-prefs:root=CASTLE&path=STORAGE_AND_BACKUP But is this legal ? – Ansari Mar 28 '17 at 08:30
  • `App-Prefs:root=Bluetooth` is working for me in iOS 10 but I am not sure, it is legit or not – Umair Aamir May 05 '17 at 10:49
  • 1
    App-Prefs:root=GAMECENTER is working on 10.3.3 (14G60) [updated today] – Michael Garito Jul 26 '17 at 01:28
  • @MichaelGarito Yes man! It's really working perfectly! Thanks you are save my time! – Genevios Aug 10 '17 at 11:25
  • iOS 10, Location Services shortcut = `App-Prefs:root=Privacy&path=LOCATION` – Sasho Aug 10 '17 at 14:34
48

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.

Jason Moore
  • 6,977
  • 1
  • 40
  • 45
  • 10
    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. https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/index.html#//apple_ref/doc/constant_group/Settings_Launch_URL – JAL Sep 30 '14 at 22:15
  • 1
    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! – kyleturner Dec 11 '14 at 19:29
  • 1
    @FabianKöbel were you able to find one for TouchID & Passcode? – ShayanK May 28 '16 at 11:57
  • 1
    @AspersionCast : you can use this: prefs:root=TOUCHID_PASSCODE (http://stackoverflow.com/questions/35410746/ios-prefs-url-scheme-for-touch-id-passcode-settings/35411090#35411090) – Fabian Köbel May 30 '16 at 15:49
  • This appears to be the only currently-Apple-approved method to launch the Settings app. – u2Fan Oct 01 '18 at 14:15
  • Nope Apple rejected our app because of this "prefs:" – ergunkocak Apr 30 '19 at 05:48
42

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.

Peter Johnson
  • 3,663
  • 1
  • 20
  • 26
Pedro Tôrres
  • 521
  • 4
  • 3
33

Update:

prefs: will NOT work since iOS 10.

Nix Wang
  • 795
  • 9
  • 18
  • 4
    What's the alternative ? – OXXY Aug 18 '16 at 13:16
  • 1
    That's crazy, since this official Apple Doc (https://developer.apple.com/library/ios/qa/qa1924/_index.html) purposely addressees the prefs issue, and dated 8/2/2016. – daspianist Sep 02 '16 at 00:44
  • 1
    That doc does say only to use it for keyboard settings (anything other than that specific use is a violation.) – Peter Johnson Sep 07 '16 at 14:48
  • Unfortunately it doesn't seem to work even for keyboard settings in iOS 10. – Intrications Sep 13 '16 at 16:16
  • Is there a reason why they removed it? Or is it a bug? If so, should report it as a [bug to Apple](https://bugreport.apple.com/) – shim Sep 15 '16 at 19:54
  • 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..) – luky Nov 16 '16 at 15:13
  • @ Nix Wang , Any other method or alternative possible for prefs: in iOS 10. – Gunja Patel Nov 22 '16 at 13:11
  • 4
    While `prefs:` no longer work, the following does (at least in opening general): `App-Prefs::root=Settings&path=General` – daspianist Jan 06 '17 at 04:50
  • Alternative is `App-Prefs:` from iOS 10 on wards. – iOS Jul 16 '20 at 10:10
22

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."

Tim
  • 14,221
  • 6
  • 37
  • 62
Dan
  • 485
  • 6
  • 9
  • 9
    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. http://bugreport.apple.com/ – Matt Connolly Apr 29 '13 at 01:44
18

In iOS 9 it works again!

To open Settings > General > Keyboard, I use:

prefs:root=General&path=Keyboard

Moreover, it is possible to go farther to Keyboards:

prefs:root=General&path=Keyboard/KEYBOARDS
Mikhail
  • 1,041
  • 2
  • 13
  • 29
  • 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. – Jamie McDaniel Sep 29 '15 at 16:41
  • Do these schemes need to be added to `LSApplicationQueriesSchemes` in `info.plist`? – Warpling Sep 29 '15 at 21:34
  • 2
    No, they don't. Just use its with openURL: method. – Mikhail Sep 30 '15 at 04:50
  • 1
    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? – Randy H. Oct 05 '15 at 16:07
  • Thanks for comment. I'll also try to check this case and respond you. – Mikhail Oct 05 '15 at 17:16
  • 3
    Still needed to add prefs URL scheme to target – shim Oct 06 '15 at 22:38
  • This works in the simulator for me but not on the device. iOS 9.1. – Aral Balkan Oct 22 '15 at 15:01
  • 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. – Mikhail Oct 23 '15 at 12:06
  • 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. – rmaddy Oct 30 '15 at 15:19
  • 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"]];` – Gautam Sareriya Nov 23 '15 at 13:22
  • 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. – daspianist Jan 30 '16 at 08:14
  • [Here in the comments](http://stackoverflow.com/a/37432131/3541063) people say this cause **rejection** on review process. – werediver Jun 15 '16 at 16:44
  • 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. – Jamie McDaniel Jun 23 '16 at 12:43
7

I wanted to open the Bluetooth Menu in the Settings Application and the above path (prefs:root=General&path=Bluetooth) didn't work for me. What ended up working for me was

UIApplication.sharedApplication().openURL(NSURL(string:"prefs:root=Bluetooth")!)

Make sure you have the prefs URL Scheme defined first.

Nate
  • 30,589
  • 12
  • 76
  • 201
Mahesh
  • 520
  • 5
  • 3
5

Solution for iOS10. Works fine.

NSURL *URL = [NSURL URLWithString:@"App-prefs:root=TWITTER"];
[[UIApplication sharedApplication] openURL:URL options:@{} completionHandler:nil];
ASP
  • 78
  • 5
4

As of iOS10 you can use

UIApplication.sharedApplication().openURL(NSURL(string:"App-Prefs:root")!) 

to open general settings.

also you can add known urls(you can see them in the most upvoted answer) to it to open specific settings. For example the below one opens touchID and passcode.

UIApplication.sharedApplication().openURL(NSURL(string:"App-Prefs:root=TOUCHID_PASSCODE")!)
mkeremkeskin
  • 644
  • 9
  • 23
2

Here is something else I found:

  1. After I have the "prefs" URL Scheme defined, "prefs:root=Safari&path=ContentBlockers" is working on Simulator (iOS 9.1 English), but not working on Simulator (Simplified Chinese). It just jump to Safari, but not Content Blockers. If your app is international, be careful.
    Update: Don't know why, now I can't jump into ContentBlockers anymore, the same code, the same version, doesn't work now. :(

  2. On real devcies (mine is iPhone 6S & iPad mini 2), "Safari" should be "SAFARI", "Safari" not working on real device, "SAFARI" now working on simulator:

    #if arch(i386) || arch(x86_64)
        // Simulator
        let url = NSURL(string: "prefs:root=Safari")!
    #else
        // Device
        let url = NSURL(string: "prefs:root=SAFARI")!
    #endif
    
    if UIApplication.sharedApplication().canOpenURL(url) {
        UIApplication.sharedApplication().openURL(url)
    }
    
  3. So far, did not find any differences between iPhone and iPad.

grg
  • 3,915
  • 3
  • 27
  • 38
Kaiyuan Xu
  • 770
  • 7
  • 12
2

Works Fine for App Notification settings on IOS 10 (tested)

if(&UIApplicationOpenSettingsURLString != nil){
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
}
Mrsantateam
  • 121
  • 2
  • 8
2

iOS 10

Use app-prefs:

App-prefs:root=MOBILE_DATA_SETTINGS_ID

See gist

Alex Hedley
  • 716
  • 7
  • 22
0

I am updating one news here. Using 'prefs:' only is NOT rejected by Apple, I tested it and checked approved to the app store(in Aug, 2016). thx.

  • i am using this `[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=DO_NOT_DISTURB"]];` for open DND Setting of device. Apple will reject this ? – Shreyank Sep 09 '16 at 12:39
  • 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. – Ahmet Akkök Nov 24 '16 at 13:23