iOS Launching Settings -> Restrictions URL Scheme
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."
kturner
Updated on October 08, 2020Comments
-
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 over 12 yearsHenri, 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 over 12 yearsNo 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 over 12 yearsIs there any official documentation on this?
-
Henri Normak over 12 yearsDidn't find any about the available URLs, only about how the URLs work. This list is put together from different sites.
-
Henri Normak over 12 yearsOf course, as URL schemes for the Settings app were introduced with iOS 5, thanks for the heads up!
-
Nik Burns over 12 yearsgithub.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 over 12 yearsWorth noting that apple will reject any apps that use or make reference to the prefs URL scheme.
-
Niklas over 12 years@NikBurns do you have any reference for that?
-
Nik Burns over 12 yearsonly from experience with AppStore review process. rdar://5864941 if you want to dupe it.
-
Jonathan Vaught over 12 yearsHas anyone come across the URL for the
Mail, Contacts, Calendar | Fetch New Data
settings? -
Hlung about 12 yearsJust 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 almost 12 yearsThey 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 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 almost 12 yearsIt's no longer working, it was working on one of my apps a while back but not anymore.
-
Matt Connolly about 11 yearsI 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 over 9 yearsAs of iOS8 you can launch the built-in Settings app with the url:
[NSURL URLWithString:UIApplicationOpenSettingsURLString]
-
JAL over 9 yearsThat'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/Reference/…
-
Henri Normak over 9 yearsIt is worth noting that the last snippet takes you to the app specific privacy settings and not just the settings app.
-
AmineG over 9 years@JasonMoore is there a way to open this settings using a link (using HTML/JS) ?
-
kyleturner over 9 yearsFantastic 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 almost 9 yearsThis trick only works starting iOS 8 where there's no need for it.
-
Pedro Tôrres almost 9 yearsBut 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 almost 9 yearsYes, you are right. Didn't think about this use case.
-
Kevin Sylvestre over 8 years@conorgriffin For you and anyone else wondering the setting lives under: Targets | (Application) | Info | URL Types | +
-
Jamie McDaniel over 8 yearsI 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 over 8 yearsDo these schemes need to be added to
LSApplicationQueriesSchemes
ininfo.plist
? -
Mikhail over 8 yearsNo, they don't. Just use its with openURL: method.
-
Randy H. over 8 yearsI 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 over 8 yearsThanks for comment. I'll also try to check this case and respond you.
-
shim over 8 yearsStill needed to add prefs URL scheme to target
-
Aral Balkan over 8 yearsThis works in the simulator for me but not on the device. iOS 9.1.
-
Mikhail over 8 yearsWell, 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 over 8 yearsThis doesn't work for me on an 5th gen iPod touch running iOS 9.0.2. I added
prefs
toLSApplicationQueriesSchemes
andcanOpenURL:
returnsNO
for any URL starting withprefs:
. AndopenURL:
does nothing. -
Gautam Sareriya over 8 yearsHi 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 over 8 yearsDid you ever get this working again? Such a shame if not!
-
Kaiyuan Xu over 8 years@RyanBrodie What do you mean by "such a shame"?
-
Ryan Brodie over 8 yearsThat it's very unfortunate, would be great to link directly into Safari's Content Blocker settings
-
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 over 8 yearsI didn't realise that thank you very much for the heads up!
-
Nate over 8 yearsThis is because the Bluetooth menu has been moved around in recent iOS versions. It's now a top-level setting, not under General.
-
daspianist over 8 yearsThis 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 over 8 years@Imran: You forgot the
prefs
-stuff. -
Hlung about 8 yearsSomeone said he got rejected for using "prefs:root" url. stackoverflow.com/questions/8246070/…
-
guyromb almost 8 yearsThis was re-added in iOS 9. Check: stackoverflow.com/questions/37399893/…
-
ShayanK almost 8 years@FabianKöbel were you able to find one for TouchID & Passcode?
-
Fabian Köbel almost 8 years@AspersionCast : you can use this: prefs:root=TOUCHID_PASSCODE (stackoverflow.com/questions/35410746/…)
-
werediver almost 8 yearsHere in the comments people say this cause rejection on review process.
-
Jamie McDaniel almost 8 yearsWe 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 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 almost 8 years@MaggiePhillips thank you. We've already launched apps with this, it was no reason to reject them.
-
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 almost 8 years@MaggiePhillips yes, these apps are already available in the App Store. It was no problem.
-
Abhishek Thapliyal almost 8 yearsWorking fine in iOS 9.2.3 Check URL Scheme : stackoverflow.com/questions/5655674/…
-
OXXY over 7 yearsWhat's the alternative ?
-
daspianist over 7 yearsThat'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 over 7 yearsThat doc does say only to use it for keyboard settings (anything other than that specific use is a violation.)
-
Shreyank over 7 yearsi am using this
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=DO_NOT_DISTURB"]];
for open DND Setting of device. Apple will reject this ? -
Igoussam over 7 yearsUnfortunately it doesn't seem to work even for keyboard settings in iOS 10.
-
shim over 7 yearsIs 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 over 7 yearsAny solution/alternative for ios10 please.
-
luky over 7 yearshey, 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 over 7 years@ Nix Wang , Any other method or alternative possible for prefs: in iOS 10.
-
Ahmet Akkök over 7 yearsHad 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 over 7 yearsWhile
prefs:
no longer work, the following does (at least in opening general):App-Prefs::root=Settings&path=General
-
Stas about 7 yearsIs this legit? Successful app submission doesn't mean that this is legit. It may fail eventually in the future..
-
Stas about 7 yearsIs 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 about 7 yearsAlmost all of these are undocumented, thus should not really be used without being ready for them to break.
-
Ansari about 7 yearsWorking if you change prefs to App-prefs, like: App-prefs:root=CASTLE&path=STORAGE_AND_BACKUP But is this legal ?
-
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 almost 7 yearsApp-Prefs:root=GAMECENTER is working on 10.3.3 (14G60) [updated today]
-
Genevios almost 7 years@MichaelGarito Yes man! It's really working perfectly! Thanks you are save my time!
-
Sasho almost 7 yearsiOS 10, Location Services shortcut =
App-Prefs:root=Privacy&path=LOCATION
-
myaug over 6 years"App-Prefs:root=TOUCHID_PASSCODE" doesn't work on iOS 11. Any other solution?
-
Tejas K almost 6 years
App-Prefs
is a private API which will lead to app rejection during review. -
Tejas K almost 6 years@Stas : No, it's not, since it is a private API.
-
u2Fan over 5 yearsThis appears to be the only currently-Apple-approved method to launch the Settings app.
-
ergunkocak about 5 yearsNope Apple rejected our app because of this "prefs:"
-
Naresh almost 4 yearsAlternative is
App-Prefs:
from iOS 10 on wards. -
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 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 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 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