I'm quite new to Swift programming I've made a simple test application that open the settings programmatically, by a specific button.
Unfortunately after the update the button, instead of opening the desired setting page (the wifi page, in this case) open only the generic setting screen Could someone please help me understanding what exactly changed in swift 4, in order for me to fix this behaviour? Thansk a lot!
First code used - (i've either changed the iOS available to iOS 11.0, in order to match the deployment)
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)
}
}
}
second code used:
let url = URL(string: "App-Prefs:root=WIFI")
UIApplication.shared.openURL(url!)
EDIT
Unfortunately the question raised is different from mine - i cannot anymore open the settings of the device, the other question ask how to open directly the settings of the APP
Urls like
App-Prefs:root
are prohibited in App Store and using it causing app rejection.If you want open app preferences you could use
UIApplicationOpenSettingsURLString