Reputation: 165
After push a message to APN sever, every time I open the app, didReceiveRemoteNotification
will call and receive the push data, how can i get rid of them?
but UIApplicationLaunchOptionsRemoteNotificationKey
is null
After I did some searching, I added these two lines in the code but it's still not working
[[UIApplication sharedApplication] setApplicationIconBadgeNumber: 0];
[[UIApplication sharedApplication] cancelAllLocalNotifications];
Upvotes: 2
Views: 673
Reputation: 2613
If your badge count is already 0, setting it to 0 won't have any effect. Try setting the badge count to a meaningless number first, and then setting it to 0.
[[UIApplication sharedApplication] cancelAllLocalNotifications];
[[UIApplication sharedApplication] setApplicationIconBadgeNumber: 99];
[[UIApplication sharedApplication] setApplicationIconBadgeNumber: 0];
Upvotes: 1