iOS 跳转到设置

作者: 拇指猿 | 来源:发表于2020-04-20 14:35 被阅读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)
                    }
                }
            }
    

    相关文章

      网友评论

        本文标题:iOS 跳转到设置

        本文链接:https://www.haomeiwen.com/subject/ixcdihtx.html