管理以单一方式触发的多个本地通知的警报?

发布于 2024-10-14 19:20:56 字数 382 浏览 7 评论 0原文

我需要您的帮助:(

场景:(在 iOS SDK 中使用 UILocalNotification)如果您在设备上看到应用程序触发的多个本地通知,您必须响应所有警报。N 个触发的通知需要点击 N 个警报。

在我的应用程序中,通知彼此密切相关,因此我想找到一种方法,通过仅点击一个警报来“消耗”所有警报

。 (几乎)解决方案:在 didReceiveLocalNotification 末尾(您管理触发的单个通知),如果您取消所有其他通知(通过 cancelAllLocalNotifications)并且其他警报消失。但这样您就取消了所有通知,因此您需要重新安排未触发的通知。 有没有更痛苦的解决方案?

提前致谢

I need your help :(

Scenario: (using UILocalNotification in iOS SDK) if you see on your device several local notifications fired by your app, you have to respond to all the alerts. N fired notification require to tap on N alerts.

This is very annoying. In my app the notifications are closely related between each other, so I would like to find a way to "consume" all the fired alerts by tapping only one alert. Is there a way?

An (almost) solution: at the end of didReceiveLocalNotification (where you manage the single notification fired) if you cancel all the other notifications (via cancelAllLocalNotifications) and the other alerts disappear. But in this way you cancel all the notifications, so you need to re-schedule the notifications not-fired.
Is there a less painful solution?

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

柠栀 2024-10-21 19:20:56

我认为您需要创建自己的警报处理程序。我的意思是,您通常会抛出一个警报,调用一个方法来跟踪多个警报(如标志),然后您可以构建一个计时器,该计时器在抛出第一个警报时启动并让它等待其他警报警报。如果在 10 秒内没有抛出其他警报,则使用您的方法构建的消息激活系统警报。如果抛出多个警报标志,则编译复合消息,然后使用该复合消息引发警报。

I think you will need to create your own alert handler. By this i mean, where you would normally throw an alert, call a method that will keep track of multiple alert like flags, and then when you could build in a timer that kicks off when the first alert is thrown and have it wait for other alerts. If no other alerts are thrown say within 10 seconds, then activate the system alert with a message built by your method. If multiple alert flags are thrown, then compile a composite message and then raise the alert with this composite message.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文