I have an app implementing push notifications with parse.
I am having some issues clearing the badge icon when a user opens up the app.
I have the following line of code in my appDelegate didFinishLaunchingWithOptions and in the app didBecomeActive:
UIApplication.sharedApplication().applicationIconBadgeNumber = 0
This works temporarily in that if I have a badge number of 18 and then I take my app out of the background via launching it, I then press the home button and I can see the app badge number was cleared and there is no longer a red icon a number in it for my app, as expected.
But then if I receive a new notification, the app badge does not read 1 as expected but instead 1 is added to the previous badge number that had been cleared and is now 19.
How can I handle this?
My app sends push notifications with the following data:
var data = [ "title": "xxx",
"alert": message,
"badge" : "Increment",
"sound" : "default"]