iOS Launching Settings -> Restrictions URL Scheme

IosIphoneSettingsUrl SchemeUiapplication

Ios Problem Overview


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

Ios Solutions


Solution 1 - Ios

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 - Ios

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 - Ios

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.

http://i.stack.imgur.com/MNNPS.png" />

Solution 4 - Ios

Update:

prefs: will NOT work since iOS 10.

Solution 5 - Ios

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

Solution 6 - Ios

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

Solution 7 - Ios

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.

Solution 8 - Ios

Solution for iOS10. Works fine.

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

Solution 9 - Ios

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")!)

Solution 10 - Ios

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.

Solution 11 - Ios

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

if(&UIApplicationOpenSettingsURLString != nil){
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
}

Solution 12 - Ios

iOS 10

Use app-prefs:

App-prefs:root=MOBILE_DATA_SETTINGS_ID

See gist

Solution 13 - Ios

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionkturnerView Question on Stackoverflow
Solution 1 - IosHenri NormakView Answer on Stackoverflow
Solution 2 - IosJason MooreView Answer on Stackoverflow
Solution 3 - IosPedro TôrresView Answer on Stackoverflow
Solution 4 - IosNix WangView Answer on Stackoverflow
Solution 5 - IosDanView Answer on Stackoverflow
Solution 6 - IosMikhailView Answer on Stackoverflow
Solution 7 - IosMaheshView Answer on Stackoverflow
Solution 8 - Iospararmswar DevelopersView Answer on Stackoverflow
Solution 9 - IosmkeremkeskinView Answer on Stackoverflow
Solution 10 - IosKaiyuan XuView Answer on Stackoverflow
Solution 11 - IosMrsantateamView Answer on Stackoverflow
Solution 12 - IosAlex HedleyView Answer on Stackoverflow
Solution 13 - IosKoreanXcodeWorkerView Answer on Stackoverflow