How to open Location services screen from setting screen?

You can open it directly like using below code,

But first set URL Schemes in Info.plist's URL Type Like:

enter image description here

Then write below line at specific event:

In Objective - C :

[[UIApplication sharedApplication] openURL:
 [NSURL URLWithString:@"prefs:root=LOCATION_SERVICES"]];

In Swift :

UIApplication.sharedApplication().openURL(NSURL(string: "prefs:root=LOCATION_SERVICES")!)

Hope this will help you.


Swift 4.2

Go straight to YOUR app's settings like this:

if let bundleId = Bundle.main.bundleIdentifier,
    let url = URL(string: "\(UIApplication.openSettingsURLString)&path=LOCATION/\(bundleId)") 
{
    UIApplication.shared.open(url, options: [:], completionHandler: nil)
}

I have tried all the above answers,it's not working on iOS11..it just opens settings page and not the app settings .. Finally this works..

UIApplication.shared.open(URL(string:UIApplicationOpenSettingsURLString)!)

Swift 4.2:

UIApplication.shared.open(URL(string:UIApplication.openSettingsURLString)!)

Refer: https://developer.apple.com/documentation/uikit/uiapplicationopensettingsurlstring?language=swift