There are a few posts on SO about this already, but there seem to be some conflicting views about iOS 10, and if it is / is not possible.
In iOS 10 is it possible to open the phones Settings app from my app? In iOS 10 is it possible to open the phones Settings app and a 'sub' setting e.g. Do Not Disturb? As it was pre iOS10.
I have added 'prefs' to info > URL Types as described in How do i open phone settings when a button is clicked ios I have tried 'Prefs' and 'prefs' Also, the app has requested permission to receive notifications so includes a settings bundle.
The code below opens to the apps settings. But how do I get it to open the phones settings and not go straight to the apps settings?
if #available(iOS 10.0, *) {
let settingsUrl = NSURL(string:UIApplicationOpenSettingsURLString) as! URL
UIApplication.shared.open(settingsUrl, options: [:], completionHandler: nil)
// THIS OPENS THE APPS SETTINGS
} else {
// Fallback on earlier versions
}
if #available(iOS 10.0, *) {
let specificUrl = NSURL(string: "prefs:root=DO_NOT_DISTURB") as! URL
UIApplication.shared.open(specificUrl, options: [:], completionHandler: nil)
// THIS DOES NOT OPEN THE PHONES DO NOT DISTURB SETTINGS.
} else {
// Fallback on earlier versions
UIApplication.shared.openURL(NSURL(string:"prefs:root=General&path")! as URL)
// This works pre iOS10 Swift 3.
}
Thanks in advance if you can help!