DidFinishLaunchingWithOptions is not working for build(not running) app in an iPhone

I am new in swift.Using didFinishLaunchingWithOptions function in AppDelegate.swift file I am counting launchCount using this code

 var openingCount:Int = 0
    
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
 
        openingCount = UserDefaults.standard.integer(forKey: "launchCount")

        // increment received number by one
        UserDefaults.standard.set(peningCount+1, forKey:"launchCount")

}

It is showing an toast if ‘openingCount’ is 0 using this logic

  let delegate = UIApplication.shared.delegate as! AppDelegate

 if ( delegate.openingCount == 0) 
{
//show toast
}

I am testing this application on iphone .If I run this application on iPhone by plugging cable it show the toast in correct way.Otherwise if I take the build and of application on iPhone, after that I unplug that iPhone from laptop and run the application in iphone it does not toast .How I can run the build application in iPhone that is unplugged ?

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum