Tab Icon Badges not updating unless view is reloaded

I am implementing badges on a tab bar icon. When I poll my server to get some data I will set the badge number based on the data response. I am able to set the badge the first time. But when I want to set it back to 0 which hides the badge. It only disappears when the view is reloaded. What is the best way to update the tab bar icon badge number without reloading the entire view ?