Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

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

###[UPDATE 2:The openURL() method of UIApplication is now deprecated. You should use application(_:open:options:) instead]

##[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]

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. Still we don't know yet how to open iPhone preferences.

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

##Objective-c

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

More info:

And there you have all the url's available:

Command Description
prefs: The topmost level General
prefs:root=General&path=About About
prefs:root=General&path=ACCESSIBILITY Accessibility
prefs:root=ACCOUNT_SETTINGS Account Settings
prefs:root=AIRPLANE_MODE Airplane Mode
prefs:root=General&path=AUTOLOCK Autolock
prefs:root=Brightness Brightness
prefs:root=General&path=Bluetooth Bluetooth iOS < 9
prefs:root=Bluetooth Bluetooth iOS > 9
prefs:root=CASTLE Castle
prefs:root=General&path=USAGE/CELLULAR_USAGE Cellular Usage
prefs:root=General&path=ManagedConfigurationList Configuration List
prefs:root=General&path=DATE_AND_TIME Date and Time
prefs:root=FACETIME Facetime
prefs:root=General General
prefs:root=INTERNET_TETHERING Internet Tethering
prefs:root=MUSIC iTunes
prefs:root=MUSIC&path=EQ iTunes Equalizer
prefs:root=MUSIC&path=VolumeLimit iTunes Volume
prefs:root=General&path=Keyboard Keyboard
prefs:root=General&path=INTERNATIONAL Lang International
prefs:root=LOCATION_SERVICES Location Services
prefs:root=General&path=Network Network
prefs:root=NIKE_PLUS_IPOD Nike iPod
prefs:root=NOTES Notes
prefs:root=NOTIFICATIONS_ID Notifications ID
prefs:root=PASSBOOK Passbook
prefs:root=Phone Phone
prefs:root=Photos Photo Camera Roll
prefs:root=General&path=Reset Reset
prefs:root=Sounds&path=Ringtone Ringtone
prefs:root=Safari Safari
prefs:root=General&path=Assistant Siri
prefs:root=Sounds Sounds
prefs:root=General&path=SOFTWARE_UPDATE_LINK Software Update
prefs:root=CASTLE&path=STORAGE_AND_BACKUP Storage & Backup
prefs:root=STORE Store
prefs:root=TWITTER Twitter
prefs:root=General&path=USAGE Usage
prefs:root=VIDEO Video
prefs:root=General&path=Network/VPN VPN
prefs:root=Wallpaper Wallpaper
prefs:root=WIFI WIFI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.