iOS App Icon Badge disappears after app goes to background

Viewed 406

We are developing an application containing a chat.

Our issue only happens after a fresh app install:

  • Install the app
  • Login of an existing user who has some unread chat messages, so I set the app badge to N (number of unread messages) when I download from the server the chat information (using setApplicationIconBadgeNumber).
  • Send the app to background (tapping the HOME button)

As the app goes to background, the app icon badge is set to N (the number of unread messages), but after a second the N badge disappears!

There are several strange behaviors in this:

  1. After the N badge disappeared, if I 'move' the app icon by long tapping and moving it on the screen the badge reappears to stay.
  2. If after launcing the app the first time and before going to background, the app receives a push notification, the badge doesn't disappear.
  3. After the first app run, on all the following runs this effect doesn't happen and the N badge remains.
  4. When the app is killed during the first run, the app badge doesn't appear at all (even if by our logs we set the value through setApplicationIconBadgeNumber).

We logged all the app setApplicationIconBadgeNumber instances and there is never a set to '0' after being set to N for the app icon badge. We also checked the system console and there are only system logs reporting the correct set of the app icon badge: [com.mychatapp.app] Setting badge number to N

0 Answers
Related