ApplicationIconBadgeNumber does not get reset when reinstalling my ipad application.

I set my applicationIconBadgeNumber file with this code:

[[UIApplication sharedApplication] setApplicationIconBadgeNumber:theIntToDisplay];

The problem is that when I uninstall the application from the iPad and reinstall it, the application icon still shows the previous icon number. Is this the default behavior of iOS or can we reset it?

I found one similar question to Why is the IconBadgeNumber application name not deleted using binding? Where was it actually stored? but he did not answer my question.

+6
source share
2 answers

This is the expected behavior, the icon number remains for a short period after removal, for example, in case of immediate reinstallation.

Of course, you can invalidate the icon number after each application launch in the application:didFinishLaunchingWithOptions: method, but I think that this is not so because you want the icon number not to be displayed immediately after installing the application and not yet launching it. In this case, just wait after uninstalling the application, and the cache code will be cleared by iOS, and then install the application again. Unfortunately, without jailbreaking a device, there is no way to manually control the behavior of icon numbers

+5
source

In your application delegate under:

 - (void)applicationWillEnterForeground:(UIApplication *)application { } 

Insert:

 application.applicationIconBadgeNumber = 0; 
+3
source

Source: https://habr.com/ru/post/949776/


All Articles