4

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

Amir Ensany
  • 41
  • 1
  • 3
  • 3
    prefs URLs are considered private api. The only documented preference URL is `UIApplicationOpenSettingsURLString` – Paulw11 Sep 29 '17 at 11:07
  • Possible duplicate of [How to open your app in Settings iOS 11](https://stackoverflow.com/questions/46421646/how-to-open-your-app-in-settings-ios-11) – Tamás Sengel Sep 29 '17 at 11:29

1 Answers1

2

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

  • 2
    This leads to App-Settings, good - but what about iPhone-Settings ? Is there a way in iOS11 to navigate to the general iPhone-Settings without using "prefs:root=" that Apple nowadays rejects form the App Store ??? – iKK Aug 29 '18 at 21:00