¿Cómo abrir las preferencias del iPhone desde nuestra app?

swift

 

En algunos momentos necesitaremos abrir las preferencias de iPhone para que el usuario pueda darle permisos, por ejemplo, a nuestras app para hacer algo. Un ejemplo sería configurar un teclado custom, hecho por nosotros; a su vez de hacerle un tutorial al usuario enseñándole en que sección de la configuración de su iPhone debe aceptar los permisos, podríamos abrir desde nuestra aplicación las preferencias de usuario.

 

 

En el gif anterior, vemos un ejemplo de como abrir las preferencias de usuario en la sección de teclados.

Escribamos algo de código:

1.-  Antes, debemos ir hasta la sección Info de nuestro Target, y seleccionar Url Types. Una vez ahí, debemos añadir un nuevo tipo en el botón + (si es que no tenemos nada). En la sección: URL Schemes debemos escribir prefs 

 

2.- Seguido escribimos el código necesario para abrir la opción que necesitemos:

Swift

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

Objective-c

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

 

Es muy pero que muy sencillo, a continuación colocaré los diferentes URL schemes que podremos usar:

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

 

 

Sofia Swidarowicz

I'm an iOS Software Engineer mostly. Known as phynet in the internez. I'm me, full of memory failure and lovely karma.

 

Leave a Reply

Your email address will not be published. Required fields are marked *