您好我无法从我的应用程序重定向到设置中的常规选项卡。在这里,我的代码请帮助解决这个问题
我在url架构中添加了prfes
guard let settingsUrl = URL(string:"prefs:root=General") else {
return
}
if UIApplication.shared.canOpenURL(settingsUrl) {
UIApplication.shared.open(settingsUrl, completionHandler: { (success) in
print("Settings opened: \(success)") // Prints true
})
}
答案 0 :(得分:3)
guard let profileUrl = URL(string: "App- Prefs:root=General") else { return } if UIApplication.shared.canOpenURL(profileUrl) { UIApplication.shared.open(profileUrl, completionHandler: { (success) in print(" Profile Settings opened: \(success)") }) }
答案 1 :(得分:1)
使用以下代码:
if let url = URL(string:UIApplicationOpenSettingsURLString) {
print(url)
}