1

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)
        }
    }
}
Jake
  • 13,097
  • 9
  • 44
  • 73
  • 3
    The `"app-prefs"` URL scheme has never been supported by Apple. No one should ever rely on it working. It has never been documented. – rmaddy Jan 31 '18 at 03:22

1 Answers1

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.

Jake
  • 13,097
  • 9
  • 44
  • 73
  • 1
    oh great - and how do one get to the iPhone-settings now ?? (i.e. to App-Settings I can use "UIApplicationOpenSettingsURLString" but what about the general iPhone-Settings. Is there a way to segue there ??? – iKK Aug 29 '18 at 20:51
  • `App-Prefs:` will still open the Settings app, but it will be opened to the last screen you were on in the Settings app. I’m not sure what the url is to make iOS open the general iPhone-Settings. – Jake Aug 29 '18 at 22:34
  • Thank you, Jake - I read on many pages that >iOS11 it is impossible to get to the general iPhone-Settings anymore :( Very poor API if you ask me ! – iKK Aug 30 '18 at 17:49