Skip to content

Instantly share code, notes, and snippets.

@deanlyoung
Forked from phynet/url-schemes-settings-ios.mkd
Last active October 31, 2024 01:13
Show Gist options
  • Save deanlyoung/368e274945a6929e0ea77c4eca345560 to your computer and use it in GitHub Desktop.
Save deanlyoung/368e274945a6929e0ea77c4eca345560 to your computer and use it in GitHub Desktop.
URL Schemes (Updated)

Note

Apple will reject apps that are using private url schemes (Ugh, Apple....) if they are pretty much obvius. Some apps are rejected and others are not, so, be aware of this issue before implementing any of those URL's in your app as a feature.

Updates

  • [UPDATE 4] iOS 10 update: apparently settings now can be reached using App-Pref instead of prefs
  • [UPDATE 3] For now you just can use url schemes to open your apps's settings with Swift 3.0 (Xcode 8). I'll keep you informed when OS preferences can be reached
  • [UPDATE 2] The openURL() method of UIApplication is now deprecated. You should use application(_:open:options:) instead
  • [UPDATE 1] Not yet tested in iOS 10. It will fail because of policies changes in URL scheme handling.

Testing

Download this Workflow to find and test new App-prefs: URL Schemes

Other Apps' Settings

Sometimes we need to open Setting's Preferences not of our app, but of the iPhone itself. What should we do to acomplish this?

keyboard

  1. You must configure the URL Schemes in your project. You will find it in Target, Info, URL Scheme. Once there, just type prefs

gif-settings

2.- Later, just write the code with the URL path of the preference needed. In my case was the keyboard path.

Swift 1.2

   UIApplication.sharedApplication().openURL(NSURL(string:"prefs:root=General&path=Keyboard")!)

Swift 3.0

This is a work around to open your app's preferences, but it will crash if you don't have any.

Open SO's preferences only #available(iOS 10.0, *):

     UIApplication.shared.open(URL(string:UIApplicationOpenSettingsURLString)!)

Open app's preferences:

   UIApplication.shared.open(URL(string:"App-Prefs:root=General&path=Keyboard")!)

Objective-c

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

URL Schemes

Settings Section Launch from Widget (Prefs:) Launch from App (App-prefs:)
Settings topmost level Prefs: App-prefs:
About Prefs:root=General&path=About App-prefs:root=General&path=About
Accessibility Prefs:root=General&path=ACCESSIBILITY App-prefs:root=General&path=ACCESSIBILITY
Account Settings Prefs:root=ACCOUNT_SETTINGS App-prefs:root=ACCOUNT_SETTINGS
Airplane Mode Prefs:root=AIRPLANE_MODE App-prefs:root=AIRPLANE_MODE
Auto-Lock iOS < 10 Prefs:root=General&path=AUTOLOCK App-prefs:root=General&path=AUTOLOCK
Auto-Lock iOS > 10 Prefs:root=DISPLAY&path=AUTOLOCK App-prefs:root=DISPLAY&path=AUTOLOCK
Battery Prefs:root=BATTERY_USAGE App-prefs:root=BATTERY_USAGE
Bluetooth iOS < 9 Prefs:root=General&path=Bluetooth App-prefs:root=General&path=Bluetooth
Bluetooth iOS > 9 && < 12 Prefs:root=Bluetooth App-prefs:root=Bluetooth
Bluetooth iOS > 12 App-prefs:Bluetooth
Cellular Prefs:root=MOBILE_DATA_SETTINGS_ID App-prefs:root=MOBILE_DATA_SETTINGS_ID
Date & Time Prefs:root=General&path=DATE_AND_TIME App-prefs:root=General&path=DATE_AND_TIME
Dictionary Prefs:root=General&path=DICTIONARY App-prefs:root=General&path=DICTIONARY
Display & Brightness Prefs:root=Brightness App-prefs:root=DISPLAY
Do Not Disturb Prefs:root=General&path=DO_NOT_DISTURB App-prefs:root=General&path=DO_NOT_DISTURB
Facetime Prefs:root=FACETIME App-prefs:root=FACETIME
General Prefs:root=General App-prefs:root=General
HealthKit App-Prefs:root=HealthKit
iCloud Prefs:root=CASTLE App-prefs:root=CASTLE
iTunes Prefs:root=MUSIC App-prefs:root=MUSIC
iTunes Equalizer Prefs:root=MUSIC&path=EQ App-prefs:root=MUSIC&path=EQ
iTunes Volume Prefs:root=MUSIC&path=VolumeLimit App-prefs:root=MUSIC&path=VolumeLimit
Keyboard Prefs:root=General&path=Keyboard App-prefs:root=General&path=Keyboard
Keyboards Prefs:root=General&path=Keyboard/KEYBOARDS App-prefs:root=General&path=Keyboard/KEYBOARDS
Language & Region Prefs:root=General&path=INTERNATIONAL App-prefs:root=General&path=INTERNATIONAL
Location Services Prefs:root=LOCATION_SERVICES App-prefs:root=LOCATION_SERVICES
Music Prefs:root=MUSIC App-prefs:root=MUSIC
Network iOS < 10? Prefs:root=General&path=Network App-prefs:root=General&path=Network
Nike iPod Prefs:root=NIKE_PLUS_IPOD App-prefs:root=NIKE_PLUS_IPOD
Notes Prefs:root=NOTES App-prefs:root=NOTES
Notifications Prefs:root=NOTIFICATIONS_ID App-prefs:root=NOTIFICATIONS_ID
Passbook Prefs:root=PASSBOOK App-prefs:root=PASSBOOK
Passwords Prefs:root=SAFARI&path=Passwords App-prefs:root=SAFARI&path=Passwords
Personal Hotspot Prefs:root=INTERNET_TETHERING App-prefs:root=INTERNET_TETHERING
Phone Prefs:root=Phone App-prefs:root=Phone
Photos & Camera Prefs:root=Photos App-prefs:root=Photos
Privacy Prefs:root=Privacy App-prefs:root=Privacy
Profiles & Device Management Prefs:root=General&path=ManagedConfigurationList App-prefs:root=General&path=ManagedConfigurationList
Reset Prefs:root=General&path=Reset App-prefs:root=General&path=Reset
Ringtone Prefs:root=Sounds&path=Ringtone App-prefs:root=Sounds&path=Ringtone
Safari Prefs:root=SAFARI App-prefs:root=SAFARI
Siri iOS < 10? Prefs:root=General&path=Assistant App-prefs:root=General&path=Assistant
Siri iOS > 10? Prefs:root=SIRI App-prefs:root=SIRI
Sounds App-prefs:Sounds
Sounds & Haptics Prefs:root=Sounds App-prefs:root=Sounds
Software Update Prefs:root=General&path=SOFTWARE_UPDATE_LINK App-prefs:root=General&path=SOFTWARE_UPDATE_LINK
Storage & Backup Prefs:root=CASTLE&path=STORAGE_AND_BACKUP App-prefs:root=CASTLE&path=STORAGE_AND_BACKUP
Store Prefs:root=STORE App-prefs:root=STORE
Twitter Prefs:root=TWITTER App-prefs:root=TWITTER
Usage Prefs:root=General&path=USAGE App-prefs:root=General&path=USAGE
Video Prefs:root=VIDEO App-prefs:root=VIDEO
VPN iOS < 10? Prefs:root=General&path=Network/VPN App-prefs:root=General&path=Network/VPN
VPN iOS > 10? Prefs:root=VPN App-prefs:root=VPN
Wallet & Apple Pay shoebox://url-scheme shoebox://url-scheme
Wallpaper Prefs:root=Wallpaper App-prefs:root=Wallpaper
Wi-Fi Prefs:root=WIFI App-prefs:root=WIFI

Open other App's Notification settings

You can open any app notification's settings, only if that app HAS notifications enabled. For that you need the bundleID added in path:

   UIApplication.shared.openURL(NSURL(string:"App-prefs:root=NOTIFICATIONS_ID&path=com.microsoft.Office.Word")! as URL)

Finding an app's bundle identifier of any app:

  • Find the app you are looking for on the Apple AppStore. For this example, we’ll use Yelp: https://itunes.apple.com/us/app/yelp/id284910350?mt=8
  • Copy the app ID number. It’s just the numbers after the text “id” and before the “?”. So in this case, it is: 284910350.
  • Paste that ID number into this URL: https://itunes.apple.com/lookup?id=284910350
  • This will download a file 1.txt
  • Search the output you get back for “bundleId”. The app’s bundle ID will be listed there: com.yelp.yelpiphone

source: https://kb.acronis.com/content/39368

Bluetooth

As @johnny77221 mention in comments, he impleted a way to open bluetooth settings, read in link above:

https://gist.github.com/johnny77221/bcaa5384a242b64bfd0b8a715f48e69f

Apple Pay / Wallet

by @luismadrigal

shoebox://

Cordova Plugin

@guyromb made a cordova plugin

https://github.com/guyromb/Cordova-open-native-settings/blob/master/src/ios/NativeSettings.m

A cocopods plugin

it seems @yoiang made a plugin for cocoapods. Although it appears that is not updated to iOS > 10 but you can contribute to his project if you like it ;)

https://github.com/Adorkable/SettingsAppAccessiOS

Open App Store

   UIApplication.shared.openURL(URL(string: "itms-apps://itunes.apple.com/app/id" + appStoreAppID)!)

Contributions:

@antonjn, @mikengyn, @johnny77221, @luismadrigal, @guyromb, @yoiang, @deanlyoung

@alexrainman
Copy link

How to open Touch ID and Passcode settings?

@farhanf
Copy link

farhanf commented Mar 15, 2019

Can't get to keyboard just opens settings...

@madhurima09
Copy link

madhurima09 commented Apr 4, 2019

Hi, does this app scheme-> app-prefs:root=General
works in devices with ios 12.2? I tried but I'm getting the error message in Safari.

@Lunziyuan
Copy link

Can't get to keyboard just opens settings...

The same with you

@jvanakker
Copy link

For your information, the step at "1. You must configure the URL Schemes in your project" is not required for this. That is ment for registering your own URL schemes for when your app receives them, which is not the point here.

@KAIOAVILA
Copy link

What's url scheme for "Screen Time"?

@liushulan0521
Copy link

Hi, How to open iPhone Storage in settings? I just type “prefs:root=General&path=iPhone Storage “ it only open the “general “page.

@deanlyoung
Copy link
Author

@liushulan0521 I think many of these could be outdated at this point

@korgx9
Copy link

korgx9 commented Oct 13, 2020

Used this for Bluetooth and Sounds and it worked for me:

  1. "App-prefs:Bluetooth"
  2. "App-prefs:Sounds"

@pistoleta
Copy link

Does anybody know where's the official documentation about this?

@Nitish157
Copy link

Used this for Bluetooth and Sounds and it worked for me:

"App-prefs:Bluetooth"
"App-prefs:Sounds"

how to use path in this case?????

@garethng
Copy link

Used this for Bluetooth and Sounds and it worked for me:

"App-prefs:Bluetooth"
"App-prefs:Sounds"

how to use path in this case?????

I add ' &path= ' and it works

@codeCasa
Copy link

App-Prefs:root=Privacy&path=Health

healthAppUrl = "App-Prefs:root=HealthKit";

@deanlyoung
Copy link
Author

@Jaggu111
Copy link

"App-prefs:Sounds" this is not working in iOS 14 ..Just opening device settings instead of About any idea?

@Mqpzi
Copy link

Mqpzi commented Apr 2, 2021

How to open the storage of device in settings? I tried "prefs:root=General&path=STORAGE" but it doesn't work in ios 14.4

@wes1993
Copy link

wes1993 commented Jun 8, 2021

@deanlyoung Thanks a llot for your work!!
I have one question:
i have seen on the web that with shortcuts we can enable and disable toggle.
I have searched everywhere but i can't fin the toggle name for this option Turn On This Line.
I think should be something like com.apple.xxxx
Some info are here:
https://support.apple.com/guide/iphone/set-up-cellular-service-iph3f11fba92/ios

@deanlyoung
Copy link
Author

@wes1993 sorry, I haven't really kept uptodate on the url schemes lately. Over the years, they have seemed to have changed quite a bit from OS version to OS version.

@sachinkmohan
Copy link

This is working again. Current iOS version 14.7.1

Prefs:root=LOCATION_SERVICES

@Ansen
Copy link

Ansen commented Oct 9, 2021

"App-prefs:root=VPN" this is not working in iOS 15.0.1, it's only open settings

@jasony9982
Copy link

Used this for Bluetooth and Sounds and it worked for me:

  1. "App-prefs:Bluetooth"
  2. "App-prefs:Sounds"

It works for me, Thanks!

@pistoleta
Copy link

Was anybody able to make work App-prefs:root=CASTLE (iCloud settings) ?

@dimonovdd
Copy link

App-Prefs:root=Privacy&path=TRACKING

@doroved
Copy link

doroved commented May 25, 2022

Prefs:root=VPN
doesn't work on iPhone XR ios 15.4.1

@imrajeshcoder
Copy link

App-prefs:root=General&path=ACCESSIBILITY does not work on iOS 16.6

@pawlek
Copy link

pawlek commented Apr 9, 2024

If I use web view in iOS app, how I can use links to open settings ?

@LuLuSaBee
Copy link

"App-prefs:General&path=GAME_CONTROLLER" able to General>Game Controller

@dcm
Copy link

dcm commented Jun 8, 2024

I found that adding /<seconds> to the end of the Auto-lock URL will highlight the appropriate timeout setting, but it won't select it. e.g.:

highlight "30 seconds": prefs:root=DISPLAY&path=AUTOLOCK/30
highlight "2 minutes": prefs:root=DISPLAY&path=AUTOLOCK/120
highlight "Never": prefs:root=DISPLAY&path=AUTOLOCK/-1

Anyone know how to select a setting rather than merely highlighting it? I tried appending these (with various letter-cases) to the end of the above URLs but no dice: /1, /0, /true, /false, /select, /selected, /check, /checked, /use, /on, /active, /activate, /activated

@furiosFast
Copy link

not work with ios 18

@RoeeNadam
Copy link

ios 18 is broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment