Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dsdstudio/d1f76126af459e44ebfeea56313a0c35 to your computer and use it in GitHub Desktop.
Save dsdstudio/d1f76126af459e44ebfeea56313a0c35 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.

[UPDATE 4] 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 : Not yet tested in iOS 10. It will fail because of policies changes in URL scheme handling.]

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.openURL(NSURL(string:"App-Prefs:root=General&path=Keyboard")! as URL)

Objective-c

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

More info:

And there you have all the url's available:

Command Swift < 3 OR Objc Swift 3 Description
prefs: App-Prefs: The topmost level General
prefs:root=General&path=About App-Prefs:root=General&path=About About
prefs:root=General&path=ACCESSIBILITY App-Prefs:root=General&path=ACCESSIBILITY Accessibility
prefs:root=ACCOUNT_SETTINGS App-Pref:root=ACCOUNT_SETTINGS Account Settings
prefs:root=AIRPLANE_MODE App-Pref:root=AIRPLANE_MODE Airplane Mode
prefs:root=General&path=AUTOLOCK App-Pref:root=General&path=AUTOLOCK Autolock
shoebox://url-scheme shoebox://url-scheme Apple Pay / Wallet
prefs:root=BATTERY_USAGE App-Pref:root=BATTERY_USAGE Batery
prefs:root=Brightness App-Pref:root=Brightness Brightness
prefs:root=General&path=Bluetooth App-Pref:root=General&path=Bluetooth Bluetooth iOS < 9
prefs:root=Bluetooth App-Pref:root=Bluetooth Bluetooth iOS > 9
prefs:root=CASTLE App-Pref:root=CASTLE Castle
prefs:root=General&path=USAGE/CELLULAR_USAGE App-Pref:root=General&path=USAGE/CELLULAR_USAGE Cellular Usage
prefs:root=General&path=ManagedConfigurationList App-Pref:root=General&path=ManagedConfigurationList Configuration List
prefs:root=General&path=DATE_AND_TIME App-Pref:root=General&path=DATE_AND_TIME Date and Time
prefs:root=FACETIME App-Pref:root=FACETIME Facetime
prefs:root=General App-Pref:root=General General
prefs:root=INTERNET_TETHERING App-Pref:root=INTERNET_TETHERING Internet Tethering
prefs:root=MUSIC App-Pref:root=MUSIC iTunes
prefs:root=MUSIC&path=EQ App-Pref:root=MUSIC&path=EQ iTunes Equalizer
prefs:root=MUSIC&path=VolumeLimit App-Pref:root=MUSIC&path=VolumeLimit iTunes Volume
prefs:root=General&path=Keyboard App-Pref:root=General&path=Keyboard Keyboard
prefs:root=General&path=INTERNATIONAL App-Pref:root=General&path=INTERNATIONAL Lang International
prefs:root=LOCATION_SERVICES App-Pref:root=LOCATION_SERVICES Location Services
prefs:root=General&path=Network App-Pref:root=General&path=Network Network
prefs:root=NIKE_PLUS_IPOD App-Pref:root=NIKE_PLUS_IPOD Nike iPod
prefs:root=NOTES App-Pref:root=NOTES Notes
prefs:root=NOTIFICATIONS_ID App-Pref:root=NOTIFICATIONS_ID Notifications ID
prefs:root=PASSBOOK App-Pref:root=PASSBOOK Passbook
prefs:root=Phone App-Pref:root=Phone Phone
prefs:root=Photos App-Pref:root=Photos Photo Camera Roll
prefs:root=General&path=Reset App-Pref:root=General&path=Reset Reset
prefs:root=Sounds&path=Ringtone App-Pref:root=Sounds&path=Ringtone Ringtone
prefs:root=SIRI App-Pref:root=SIRI Siri
prefs:root=Safari App-Pref:root=Safari Safari
prefs:root=General&path=Assistant App-Pref:root=General&path=Assistant Siri
prefs:root=Sounds App-Pref:root=Sounds Sounds
prefs:root=General&path=SOFTWARE_UPDATE_LINK App-Pref:root=General&path=SOFTWARE_UPDATE_LINK Software Update
prefs:root=CASTLE&path=STORAGE_AND_BACKUP App-Pref:root=CASTLE&path=STORAGE_AND_BACKUP Storage & Backup
prefs:root=STORE App-Pref:root=STORE Store
prefs:root=TWITTER App-Pref:root=TWITTER Twitter
prefs:root=General&path=USAGE App-Pref:root=General&path=USAGE Usage
prefs:root=VIDEO App-Pref:root=VIDEO Video
prefs:root=General&path=Network/VPN App-Pref:root=General&path=Network/VPN VPN
prefs:root=Wallpaper App-Pref:root=Wallpaper Wallpaper
prefs:root=WIFI App-Pref:root=WIFI WIFI

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

Contributions:

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

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