更新时间:2023-01-01 16:22:01
从 iOS 8 开始,可以通过这种方式启动直接打开隐私应用部分的设置应用:
As of iOS 8, it's possible to launch the Settings app that directly opens your Privacy app section in this way:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
在 Swift 中:
if let settingsURL = NSURL(string: UIApplicationOpenSettingsURLString) {
UIApplication.sharedApplication().openURL(settingsURL)
}
在 Swift 3.0 中:
In Swift 3.0:
if let settingsURL = URL(string: UIApplicationOpenSettingsURLString + Bundle.main.bundleIdentifier!) {
UIApplication.shared.openURL(settingsURL as URL)
}