有没有办法访问通知中心中显示的通知? [英] Is there a way to access the notifications shown in the notification center?

查看:110
本文介绍了有没有办法访问通知中心中显示的通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一种待办事宜本地通知,可以触发.

I have kind of to-do local notifications that are fired OK.

例如,如果触发了2条通知,则徽章编号将变为2.

So for example if 2 notifications have fired the badge number goes to 2.

现在,我喜欢在用户直接启动应用程序(而不是通过通知中心)时处理这些通知.

Now I like to handle these notifictaions also when the user just starts the app directly - not via the notifictaion center.

因此徽章编号为2,用户单击应用程序图标以启动应用程序,并且应用程序应知道通知中心中有2条通知.

So the badge number would be 2, the user clicks on the app icon to start the app and the app should know which 2 notifications are in the notifictaion center.

虽然我知道如何在触发之前获取所有计划的通知,但有一种方法可以访问已发生的通知中心中存在的所有通知.

While I know how to get all scheduled notifications BEFORE they fire - is there a way to access all the notifications that are present in the notification center since they HAVE FIRED.

由于用户还可以直接从通知中心清除通知,因此实际上没有办法从应用程序内部跟踪通知中心中显示的通知.

Since the user could also clear the notifications from the notification center directly, there is really no way to keep track of the shown notifications in the notification center from within the app.

非常感谢!

推荐答案

iOS不支持应用程序查询通知中心中的通知.通知是通知用户而不是应用程序(至少在用户对其执行操作之前).

iOS doesn't provide support for applications to query what notifications are in the Notification Center. The notifications are notifications to the user not to the app (at least not until the user acts on them).

这篇关于有没有办法访问通知中心中显示的通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆