【发布时间】:2021-03-10 16:13:02
【问题描述】:
我正在请求用户授权以发送通知,这样做时会弹出警报并显示默认通知消息和Don't allow / Allow 按钮,正如预期的那样。
但是,如果我没有选择应用程序背景,然后再次重新打开应用程序,我无法让警报再次显示。
我可以再次强制调用 requestAuthorization,并且我在完成块中正确地看到授权请求是错误的(因为之前没有做出选择)。
let options: UNAuthorizationOptions = [.alert, .badge, .sound]
UNUserNotificationCenter.current().requestAuthorization(options: options) { (granted, error) in
// granted = false
}
但是为什么提示不再显示呢?
如有任何澄清,我们将不胜感激。
作为旁注,我注意到在请求用户位置时,在做出选择之前,我什至无法最小化应用程序!
【问题讨论】:
标签: swift push-notification nsnotificationcenter