Okay, I know that there are many question about it, but they are all from many time ago.
So. I know that it is possible because the Map app does it.
In the M
From @Yatheeshaless's answer:
You can open settings app programmatically in iOS8, but not in earlier versions of iOS.
Swift:
UIApplication.sharedApplication().openURL(NSURL(string:UIApplicationOpenSettingsURLString)!)
Swift 4:
if let url = NSURL(string: UIApplicationOpenSettingsURLString) as URL? {
UIApplication.shared.openURL(url)
}
Swift 4.2 (BETA):
if let url = NSURL(string: UIApplication.openSettingsURLString) as URL? {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
Objective-C:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
SWIFT 4.0
'openURL' was deprecated in iOS 10.0: Please use openURL:options:completionHandler: instead
UIApplication.shared.open(URL.init(string: UIApplicationOpenSettingsURLString)! , options: [:], completionHandler: nil)
To add to accepted answer: (from apple developer documentation) "When you open the URL built from this string (openSettingsURLString), the system launches the Settings app and displays the app’s custom settings, if it has any." So, if you want to open settings for your app, create your own Settings.bundle.
Swift You can use following function to open Settings App with Bluetooth Page
func openSettingsApp(){
if let settings = NSURL(string: "prefs:root=Bluetooth") {
UIApplication.sharedApplication().openURL(settings)
}
}
Again this would not open the App's Settings. This would open settings app with Bluetooth as this is deep linking to bluetooth.
In Swift 3 / iOS 10+ this now looks like
if let url = URL(string: "App-Prefs:root=LOCATION_SERVICES") {
UIApplication.shared.open(url, completionHandler: .none)
}