App-Prefs: root=NOTIFICATIONS_ID Not working on iOS 11 Swift 4

Viewed 1774

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?

1 Answers

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
    })
}
Related