一、原因
在ios 开发中如果我们要获取到用户的位置、或者打开摄像头照相机等需要经过用户的同意,因为从ios7开始,苹果很注重用户的隐私,所以如果用户关掉了位置、照相机则应用无法自动打开,所以在需要访问的时候,应用最好可以很友好的提示并引导用户到设置界面,所以就需要知道如果跳转到界面
二、ios7
在ios7中很多设置都在用户的隐私中,一般情况下我们会弹出一个弹框,用户点击“设置”-》跳转到相应界面
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 1) {
if ([[UIDevice currentDevice].systemVersion doubleValue] > 7.0) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
} else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=Privacy"]];
}
}
// [self dismissViewControllerAnimated:YES completion:nil];
}
三、ios8
ios8支持自动跳转到设置界面的功能