I have an application that stores values ββin the viewWillDisappear method in one of my classes. For example, I store data and time in the viewWillAppear method, and also the same when in the viewWillDisappear method, so I can compare the time difference and write it down.
However, if the user clicks the home button on the device, the viewWillDisappear code viewWillDisappear not start. I tried calling this specific method in the AppDelegate applicationDidEnterBackground , but it stores incorrect information since the viewWillDisappear method is viewWillDisappear actually running. I also tried to save them in NSUserDefaults , but again, since the viewWillDisappear method viewWillDisappear not running, then the wrong values ββare saved.
Is it possible to run the viewWillDisappear method for this view as soon as the user clicks his home button?
source share