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

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

@mohmmd-ishtiaq
Copy link

I am having issue with iOS 18

@ThuggishNuggets
Copy link

18 years in and we still do not have a public API/URL Scheme for doing simple tasks like opening a system Settings pane. This is beyond stupid at this point, and of course it's broken in iOS 18, of course it is.

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