我想通过以下警告启动设置应用:
- (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"]];
}
}
我使用了prefs:root = General,但后来我从下面的链接中读到了......
iOS Launching Settings -> Restrictions URL Scheme
...这在ios5.1中是不可能的。事实上,它在模拟器中不起作用。我能做什么??谢谢你的帮助
答案 0 :(得分:0)
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General&path=Assistant "]];
“设置”应用中当前已知的网址列表:
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
答案 1 :(得分:-3)
试试这个(适用于iOS 5及更高版本):
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs://"]];