iOS功能 - 从APP中跳转到手机设置
从 APP 跳转到手机设置界面
1 - 在 iOS 开发中,有时会有跳转系统设置界面的需求。在 iOS 6 之后第三方应用需要跳转系统设置界面,需要在 URL type 中添加一个 Prefs 值
2 - 用一个宏用来版本判定:#define iOS10 ([[UIDevice currentDevice].systemVersion doubleValue] >= 10.0)
1 NSString * urlString = @"App-Prefs:root=LOCATION_SERVICES";// 设置连接 2 if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:urlString]]) { 3 if (iOS10) { 4 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString] options:@{} completionHandler:nil]; 5 }else { 6 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]]; 7 } 8 }