Search code examples
iosiphoneswift3ios10

How to Redirect from my own app to Settings General tab in setting swift 3.0


Hi I am not able to redirect from my app to General tab in setting. Here my code please help on this

I added prfes in url schema

guard let settingsUrl = URL(string:"prefs:root=General") else {
        return
    }

    if UIApplication.shared.canOpenURL(settingsUrl) {

         UIApplication.shared.open(settingsUrl, completionHandler: { (success) in
             print("Settings opened: \(success)") // Prints true
         })

     }

Solution

  • in iOS 10 they changed "prefs:" to "App-Prefs:"

            guard let profileUrl = URL(string: "App-    
             Prefs:root=General") else {
                return
            }
    
             if UIApplication.shared.canOpenURL(profileUrl) {
    
             UIApplication.shared.open(profileUrl, completionHandler: { (success) in
    
                print(" Profile Settings opened: \(success)")
    
                })
             }