1

I have integrated push notification into iOS app. My problem is once I install the app, and reinstall it in another time, even before I login through the app my app icon shows the badge count. I dont want to show it if the user has logged out. So when user click on the logout I set the badge count as 0. But when I install it again, even before I log into it my app shows the notification badge count as a different number.

How can I avoide this? Please help me. Thanks

user1960169
  • 3,533
  • 12
  • 39
  • 61

2 Answers2

1

You need to add more logic to your badge updates. In the app delegate, when the app is launched and / or you receive a notification you should check the user login status and update the badge number. If the user is not logged in then you can always simply set to zero.

Wain
  • 118,658
  • 15
  • 128
  • 151
0

set badge 0 inside logout button action

-(void)logout{
  [UIApplication sharedApplication].applicationIconBadgeNumber = 0;
  //.....
 }
Jamil
  • 2,977
  • 1
  • 13
  • 23