You should set this:
[UIApplication sharedApplication].applicationIconBadgeNumber = 0;
in
either of these AppDelegate methods if the application is launched and sent to background then you launch the application didFinishLaunchingWithOptions
method will not be called so use either of these methods:
- (void)applicationWillEnterForeground:(UIApplication *)application
- (void)applicationDidBecomeActive:(UIApplication *)application
For Swift 3+
- func applicationWillEnterForeground(_ application: UIApplication)
- func applicationDidBecomeActive(_ application: UIApplication)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…