Clear applicationIconBadgeNumber without removing notifications not working

后端 未结 2 1282
借酒劲吻你
借酒劲吻你 2021-01-12 01:15

I\'ve read in a few posts (like this one https://forums.developer.apple.com/thread/7598) that setting

    application.applicationIconBadgeNumber = -1
         


        
2条回答
  •  失恋的感觉
    2021-01-12 02:03

    UIApplication.sharedApplication.applicationIconBadgeNumber = -1;
    

    I have tested it in iOS 12.2 and it's working fine for me with remote notification.

    It is clearing badge count by keeping received remote notification in notification centre.

    Code snippet for reference:

    - (void)applicationDidBecomeActive:(UIApplication *)application {
        UIApplication.sharedApplication.applicationIconBadgeNumber = -1;
    }
    

提交回复
热议问题