简体   繁体   中英

Settings button in swift 3, Xcode

The problem I have is that I want to have a settings button which when the user clicks it, takes them to a specified path in the settings such as sound settings. The only issue is that every method I've tried has been outdated for more recent versions of iOS 10. Does anyone have any suggestions for a method which I can use? Any help will be greatly appreciated.

You can open your app Settings page by...

let settings_app: URL = URL(string: UIApplicationOpenSettingsURLString)!
UIApplication.shared.open(settings_app)

But you can't open other Settings app section from any app.

Try the following code, I hope to help you

let settingsUrl = NSURL(string:UIApplicationOpenSettingsURLString) as! URL
if #available(iOS 10.0, *) {
    UIApplication.shared.open(settingsUrl, options: [:], completionHandler: nil)
} else {
    // Fallback on earlier versions
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM