iOS 跳转到设置
2020-04-20 本文已影响0人
拇指猿
应用跳转到设置,这是目前可行的方案。
guard let newUrl = URL.init(string: "App-Prefs:root=NOTIFICATIONS_ID"), let newUrl2 = URL.init(string: UIApplication.openSettingsURLString) else { return }
if #available(iOS 11.0, *) {
if UIApplication.shared.canOpenURL(newUrl2) {
UIApplication.shared.open(newUrl2, options: [UIApplication.OpenExternalURLOptionsKey : Any](), completionHandler: nil)
}
}
else {
if UIApplication.shared.canOpenURL(newUrl) {
if #available(iOS 10.0, *) {
UIApplication.shared.open(newUrl, options: [UIApplication.OpenExternalURLOptionsKey : Any](), completionHandler: nil)
}
else {
UIApplication.shared.openURL(newUrl)
}
}
}