1

How I can override an already displayed Local Notification?

I just want one notification for a particular event where the value is changing from time to time, when a change for the event appear.

For the moment there is always a new notification created.

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Chris
  • 97
  • 1
  • 7
  • Notifications that has been already displayed cannot be modified. – Sulthan Apr 21 '16 at 07:05
  • 1
    I assume you mean to change an already scheduled notification, right? – Darko Apr 21 '16 at 07:13
  • Yes but the notification should not be really scheduled. I want to have something like that: App is in background mode, there is something happening --> Notification on screen, now maybe 10 seconds after or 5 seconds after or X -seconds after there will be a changed for the same event X-seconds before. Now I want to change this notification from before, without displaying a new one. – Chris Apr 21 '16 at 07:15

1 Answers1

3

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.

Reference link

Community
  • 1
  • 1
Payal Maniyar
  • 4,293
  • 3
  • 25
  • 51
  • Thanks. So this sounds I should cancel the notification before I create the same one just with an updated text. – Chris Apr 21 '16 at 07:28