applicationdidbecomeactive not called iOS swift

 Problem:

I want to remove the badge number to 0 while launch.I tried in applicationdidbecomeactive method.But it was not called in my app while launch.


Solution:

    func sceneWillEnterForeground(_ scene: UIScene) {

        DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {

            

                UIApplication.shared.applicationIconBadgeNumber = 0


        }

    }

In scene delegate class you have to call the above function and you can achieve that.

Comments

Popular posts from this blog

store cgpoint in userdefaults iOS swift

libc++abi: terminating due to uncaught exception of type NSException iOS swift