Swift 4-IOS 11/"Apps-prefs = root"功能不起作用 [英] Swift 4 - IOS 11 / “Apps-prefs=root” function not working

查看:125
本文介绍了Swift 4-IOS 11/"Apps-prefs = root"功能不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个简单的测试应用程序,可以通过特定按钮以编程方式打开设置"应用程序. 无需打开所需的设置页面(在这种情况下为wifi页面),而是打开常规设置屏幕.有人可以帮我了解Swift 4中的确切变化,以便我解决此问题吗?非常感谢!

I've made a simple test application that open the Settings app programmatically, by a specific button. Instead of opening the desired settings page (the wifi page, in this case) it opens the generic setting screen. Could someone please help me understanding what exactly changed in Swift 4, in order for me to fix this behavior? Thansk a lot!

此代码:

if let url = URL(string:"App-Prefs:root=WIFI") {
    if UIApplication.shared.canOpenURL(url) {
       if #available(iOS 10.0, *) {
            UIApplication.shared.open(url, options: [:], completionHandler: nil)
        } else {
            UIApplication.shared.openURL(url)
        }
    }
}

推荐答案

这不是Swift 4问题. Apple经常更改设置"应用程序的网址.虽然某些较旧版本的设置"应用程序支持App-Prefs:root=WIFI,但iOS 11中的设置"应用程序不支持它.

This is not a Swift 4 issue. Apple changes the Settings app urls very often. While some older versions of the Settings app support App-Prefs:root=WIFI, the Settings app in iOS 11 does not support it.

这篇关于Swift 4-IOS 11/"Apps-prefs = root"功能不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆