2

I wanted to launch settings app from an alert like you see below:

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex

{ NSString *title = [alertView buttonTitleAtIndex:buttonIndex];

if([title isEqualToString:@"Ok"])
{
    NSLog(@"Ok was selected.");
}
else if([title isEqualToString:@"Safari"])
{
    NSLog(@"open Safari was selected.");
      [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General"]];
}

}

I used prefs:root=General, but then I read from the link below...

iOS Launching Settings -> Restrictions URL Scheme

...that this is not possible in ios5.1. Infact it does not work in the simulator. what can I do?? Thanks for the help

Community
  • 1
  • 1
Alessandro
  • 4,000
  • 12
  • 63
  • 131

2 Answers2

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

List of currently known URLs in the Settings app:

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
Mani
  • 1,841
  • 15
  • 29
-3

Try this (works on iOS 5 and up):

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs://"]];
Matthias Bauch
  • 89,811
  • 20
  • 225
  • 247
LJ Wilson
  • 14,445
  • 5
  • 38
  • 62