I have set the badge number of my app to 1 with a local not开发者_如何学Cification. Then I uninstall the app. When I reinstall it the badge is still there. Is this an iOS bug or is there a way to clear the badges when it gets uninstalled?
thanks.
The badge count is maintained by the operating system, independent of the app. When an app is uninstalled (deleted), some values are retained by the operating system, including the badge count until a day. When the app is uninstalled, no developer method or script is called. Actually there is a technical note from Apple about the matter: Here is the excerpt from Apple's official Technical Notes about push notifications:
The first time a push-enabled app registers for push notifications, iOS asks the user if they wish to receive notifications for that app. Once the user has responded to this alert it is not presented again unless the device is restored or the app has been uninstalled for at least a day. If you want to simulate a first-time run of your app, you can leave the app uninstalled for a day. You can achieve the latter without actually waiting a day by following these steps:
- Delete your app from the device.
- Turn the device off completely and turn it back on.
- Go to Settings > General > Date & Time and set the date ahead a day or more.
- Turn the device off completely and turn it back on.
As I know, iOS remembers badge value (which is appeared on the app icon). So you have to wait for a short period of time (1 day maybe), and then try to install it again.
精彩评论