I am developing an app for iOS, in which I have to check the GPS, whether 'Location Services' is off or not. If 'Location Services' is off, then I have to launch the Settings app with url "Settings->Privacy->Location Services", in which user can enable the 'Location Services'. For this I am using the following code
if let url = URL(string: "App-Prefs:root=Privacy&path=LOCATION")
{
if #available(iOS 10.0, *) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
else
{
UIApplication.shared.openURL(url)
// Fallback on earlier versions
}
}
But this will only launch the 'Settings' app with last active session of settings app not in 'Location Services'. I am using Swift 5 with Xcode 11 beta 2. I have listen about custom url scheme. But don't know how to use it properly. Please guide me for this.