0

I currently have an application that receives the correct badge number via push notification. The backend server keeps track of the number of unread updates and sends the number in a push notification when an event happens. The application badge number is then automatically set. When the user clicks on a specific part of the application the badge count is decremented and synched with the backend. This should all work in theory. However, I can't seem to make the badge stay after the user opens the application after receiving the initial push. How do I make the number stay, I looked into the issue and solving it using local notifications with the information located here: iOS badge number live update but I am hoping to use a simpler solution. Thanks for the help!

Community
  • 1
  • 1
ScottOBot
  • 839
  • 3
  • 16
  • 37

2 Answers2

3

In your application delegate, do you have any code that is clearing the badge count i.e.

[UIApplication sharedApplication].applicationIconBadgeNumber = 0;

||

[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
CW0007007
  • 5,681
  • 4
  • 26
  • 31
0

In my case, it was because I was using Airship's SDK and instead of using their code for updating the badge count, I was using the iOS native code and that caused a glitch, especially right after a reinstallation and grant the push perms again.

Also, they have a reset method so if you are using them or any other library and that library has such capability, I would strongly advise against manually touching iOS push delegates, setting badge count number the classic way, etc. and seek to use the SDK's implementation instead.

Amir Hajiha
  • 836
  • 8
  • 20