How to programmatically open the Bluetooth settings in iOS 10

Solution 1:

func openBluetooth(){
    let url = URL(string: "App-Prefs:root=Bluetooth") //for bluetooth setting
    let app = UIApplication.shared
    app.openURL(url!)
}

Swift 3.0: working up to iOS 10

Note: This URL is "private API". The app will be rejected by App Store reviewers if used.

Solution 2:

You will not be able to use the solution by @Siddharth jain. The Problem: The app will be rejected by Apple with a warning that you should never use non-public APIs anymore. Otherwise, you could risk your developer program.

As far as I know, all you can do is open the iPhone settings in general (or get lead to your app settings if there are some. To do so you need the following code

guard let url = URL(string: UIApplication.openSettingsURLString) else {
    // Handling errors that should not happen here
    return
}
let app = UIApplication.shared
app.open(url)

By this, you will always get a URL you can use without any problems with apple review.

Solution 3:

Until now you cannot access to bluetooth settings from your app from iOS 10. you can see the following link to keep your mind at peace.

https://forums.developer.apple.com/message/146658#146658 Opening the Settings app from another app