有没有一种简单的方法来编辑/修改 UILocalNotification

发布于 2024-09-25 22:17:10 字数 130 浏览 0 评论 0原文

是否有更简单的方法来编辑,例如,已安排的 UILocalNotification 的alertBody 属性?

目前,我只是取消通知并安排一个新的通知,但是当应用程序需要为 3 个或更多通知执行此操作时,需要很长时间才能执行...

Is there an easier way to edit, for example, the alertBody property of an already scheduled UILocalNotification ?

For now, I just cancel the notification and schedule a new one but when the app needs to do this for 3 or more notifications, it takes long time to execute...

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

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

发布评论

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

评论(2

调妓 2024-10-02 22:17:10

如果文档正确,您将无法更改已安排的通知。该文档声明 -scheduleLocalNotification:

[...]因为操作系统复制
通知,您可以发布一次
您已经安排好了。

通知对象由系统复制,并且无法通过任何(公共)方法访问。所以除了取消通知之外没有其他解决办法。

If the documentation is correct, you can't alter an already scheduled notification. The doc states for -scheduleLocalNotification::

[…] Because the operating system copies
notification, you may release it once
you have scheduled it.

The notification object is copied by the system and not accessible via any (public) method. So there's no other solution than canceling the notification.

何处潇湘 2024-10-02 22:17:10

您无法对其进行编辑,但可以通过取消通知并安排新通知以用新数据替换它来实现类似的效果。使用

- (void)cancelLocalNotification:(UILocalNotification *)notification

You can't edit it, but you can achieve a similar effect by canceling a notification and scheduling a new one to replace it with the new data. Use

- (void)cancelLocalNotification:(UILocalNotification *)notification

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