4

I'm trying to use:

UIApplication.shared.open(URL(string:"App-Prefs:root=NOTIFICATIONS_ID")!, options: [:], completionHandler: nil)

But it's just sending me to the Settings app, not to the Notification tab.

I have tried this without luck.

Any solution?

4b0
  • 21,981
  • 30
  • 95
  • 142
  • 1
    Looks like you were using undocumented API and it stoped to work. Check this question: https://stackoverflow.com/q/33003961/3050403 – kelin Nov 05 '17 at 22:51
  • Not working too. https://gist.github.com/deanlyoung/368e274945a6929e0ea77c4eca345560 didn't help. – Nike Kov Feb 16 '18 at 14:16

1 Answers1

2

Apple will Reject your app submission. Because this is the private api. Use the below function in the below. ref: How do I open phone settings when a button is clicked?

guard let settingsUrl = URL(string: UIApplication.openSettingsURLString) else {
    return
}

if UIApplication.shared.canOpenURL(settingsUrl) {
    UIApplication.shared.open(settingsUrl, completionHandler: { (success) in
         print("Settings opened: \(success)") // Prints true
    })
}
Zgpeace
  • 3,927
  • 33
  • 31