Reputation: 1605
I am using parse to handle my push notifications. I send a notification to my app, with option "Increase Badge Number" selected. It sets the badge at 1. Then I call this in the app:
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
[[UIApplication sharedApplication] cancelAllLocalNotifications];
This works as expected, clears badge number.
Then I send another push notification in parse with "Increase Badge Number" selected again. However this time the badge on the app shows 2. Again the code clears the badge, but I want it to show 1 at that point, am I missing some code? Or is this a parse issue?
Upvotes: 1
Views: 862
Reputation: 38526
You're clearing it in iOS, but you're not changing the value for the badge on the Installation object on Parse. So, if you just call increment, yeah the number will be bigger than you expect.
You could add this to your above example:
[[PFInstallation currentInstallation] setObject:@0 forKey:@"badge"];
[[PFInstallation currentInstallation] saveEventually];
So that the badge number gets cleared out on the Parse side and future increments will do what you expect.
Upvotes: 3