我正在尝试使用:
UIApplication.shared.open(URL(string:"App-Prefs:root=NOTIFICATIONS_ID")!, options: [:], completionHandler: nil)
但是它只是将我发送到“设置”应用,而不是“通知”标签。
我没有运气就尝试过this。
任何解决方案?
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
})
}