0

So I've got a UILocalNotification setup to change the Icon badge.

[myNote setApplicationIconBadgeNumber:[[UIApplication sharedApplication] applicationIconBadgeNumber]+1];

So it works fine if I don't change the badge number after I set it. If the badge shows 2, lets say, when I set the notification, it changes to 3 when the notification goes off. But lets say that I change it from 2 to 5 within the app before the notification fires, it still changes it to 3 when it does fire.

I need it to be able to add 1 to the current badge number, not the number that the badge showed when I first scheduled the notification. Ex: If it's 2 when I schedule the notification, then change it to 5 in the app, the notification should change it 6 when it does fire.

Is there a way to do it? I'm beginning to hate UILocalNotification.

Thanks guys!

mhbdr
  • 753
  • 2
  • 10
  • 26

1 Answers1

1

Unfortunately, there is no such API. You can, however, discard all your previous notifications and reschedule them with the updated badge number. But I agree with you, local notifications and badge numbers are bound to reach a brick wall and annoy you.

Léo Natan
  • 56,823
  • 9
  • 150
  • 195
  • Yep, been having a lot of issues with them. Just to ask quickly, is there an easy way just to reschedule everything? I doubt it's that simple, but just wondering. Thanks for the response. – mhbdr Jan 26 '13 at 01:03
  • How do you determine your notifications? If it is something simple, just run your algorithm which would schedule them from scratch. If you have some complex doing, some persistence method may be helpful, such as user defaults, Core Data, etc. – Léo Natan Jan 26 '13 at 01:15