9

The UIApplication badge number is not deleted at reinstall.

In case I uninstall the application when the badge has a non zero value, and then re-install it, the badge still appears in the new installation.

I update the badge number in the following manner:

[[UIApplication sharedApplication] setApplicationIconBadgeNumber:badgeNumber];

Tried to find a solution - some notification when the application terminates so I can remove the badge... Couldn't make it with applicationWillTerminate. Any suggestions?

yaara4
  • 304
  • 3
  • 8
  • is there a condition for the badge to be displayed ? is that condition still true once you reinstalled your app ? –  Feb 16 '12 at 15:57
  • I am struggling with the same issue. On installing the app on my device the badge number is 1. Is there a way to set the default badge number for an app when its installed. – NSRover Mar 04 '12 at 05:24

2 Answers2

5

Apple actually responded and this is the expected behavior, the badge remains for a short period after uninstall (exactly for the case of an immediate re-install).

Pang
  • 9,564
  • 146
  • 81
  • 122
yaara4
  • 304
  • 3
  • 8
1

Try to set:

[[UIApplication sharedApplication] setApplicationIconBadgeNumber:-1];

in application: didFinishLaunchingWithOptions:

Worked fine for me.

Nate
  • 31,017
  • 13
  • 83
  • 207
mnickv31
  • 482
  • 3
  • 9
  • 1
    Don't you get the question? He asked that is there any way that we can clear the badge on reinstall.. with your answer, unless he opens the app for atleast one time, the badge will be showed on app icon. – Mujib Saiyyed Jan 18 '16 at 12:19