有没有一种简单的方法来编辑/修改 UILocalNotification
是否有更简单的方法来编辑,例如,已安排的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果文档正确,您将无法更改已安排的通知。该文档声明
-scheduleLocalNotification:
:通知对象由系统复制,并且无法通过任何(公共)方法访问。所以除了取消通知之外没有其他解决办法。
If the documentation is correct, you can't alter an already scheduled notification. The doc states for
-scheduleLocalNotification:
: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.
您无法对其进行编辑,但可以通过取消通知并安排新通知以用新数据替换它来实现类似的效果。使用
- (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