Swift 4 - IOS 11 / “Apps-prefs=root” function not working

…衆ロ難τιáo~ 提交于 2019-12-11 04:27:17

问题


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!

This code:

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)
        }
    }
}

回答1:


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.



来源:https://stackoverflow.com/questions/48533748/swift-4-ios-11-apps-prefs-root-function-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!