App-Prefs:root = NOTIFICATIONS_ID在iOS 11 Swift 4上不起作用

问题描述 投票:4回答:1

我正在尝试使用UIApplication.shared.open(URL(string:"App-Prefs:root=NOTIFICATIONS_ID")!, options: [:], completionHandler: nil),但这只是将我发送到“设置”应用,而不是“通知”标签。

我没有运气就尝试过this

任何解决方案?谢谢

ios notifications ios11 swift4
1个回答
0
投票

Apple将拒绝您提交的应用程序。因为这是专用API。在下面使用以下功能。参考: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
    })
}
© www.soinside.com 2019 - 2024. All rights reserved.