Reset iOS app badge Reset iOS app badge xcode xcode

Reset iOS app badge


[UIApplication sharedApplication].applicationIconBadgeNumber = 0; Not helps to clear badge in parse. I just read the Parse Push notification Guide Documentation and the Documentation said.

badge: The current value of the icon badge for iOS apps. Changing this value on the PFInstallation will update the badge value on the app icon. Changes should be saved to the server so that they will be used for future badge-increment push notifications.

badge: (iOS only) the value indicated in the top right corner of the app icon. This can be set to a value or to Increment in order to increment the current value by 1.

Clearing the Badge You need to do Code like:

- (void)applicationDidBecomeActive:(UIApplication *)application {  PFInstallation *currentInstallation = [PFInstallation currentInstallation];  if (currentInstallation.badge != 0) {    currentInstallation.badge = 0;    [currentInstallation saveEventually];  }  // ...}


For anyone looking for how to reset the badge in swift, here's the swift version @nitin's answer which was spot on.

func applicationDidBecomeActive(application: UIApplication) {    var current: PFInstallation = PFInstallation.currentInstallation()    if (current.badge != 0) {        current.badge = 0        current.saveEventually()    }}