Skip to content

Instantly share code, notes, and snippets.

@corybohon
Created March 14, 2013 02:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save corybohon/5158471 to your computer and use it in GitHub Desktop.
Save corybohon/5158471 to your computer and use it in GitHub Desktop.
Remove local and remote notifications in iOS apps. Simply put this in your App Delegate, and then call [self clearNotifications] in -didFinishLaunchingWithOptions, or another delegate method of your liking in your App Delegate. Personally, I like putting it in -- (void)applicationWillEnterForeground:(UIApplication *)application because that meth…
- (void) clearNotifications
{
[[UIApplication sharedApplication] cancelAllLocalNotifications];
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:1];
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment