UIApplication icon badge number remains at re-install [duplicate]

99封情书 提交于 2019-12-09 09:40:07

问题


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?


回答1:


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




回答2:


Try to set:

[[UIApplication sharedApplication] setApplicationIconBadgeNumber:-1];

in application: didFinishLaunchingWithOptions:

Worked fine for me.



来源:https://stackoverflow.com/questions/9314025/uiapplication-icon-badge-number-remains-at-re-install

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!