viewDidDisappear not called

Originator:johanvase
Number:rdar://14744330 Date Originated:15-Aug-2013 09:27 AM
Status:Open Resolved:
Product:iOS SDK Product Version:6.0+
Classification:Other Bug Reproducible:Always
 
Summary:
viewWillDisappear: method are not being fired when doing popToRootViewControllerAnimated: immediately followed by presentModalViewController in AppDelegate. applicationDidBecomeActive:


STEPS TO REPRODUCE:

Writing the code yourself:
1) Create a UINavigationController and make it possible to push two view controllers on it. Implement the viewWillDisappear method in the two view controllers
2) In AppDelegate.applicationDidBecomeActive: insert the following code (the functionality/kind of "loginViewController" does not matter):
- (void)applicationDidBecomeActive:(UIApplication *)application
{
    [(UINavigationController *)self.window.rootViewController popToRootViewControllerAnimated:NO];
    [self.window.rootViewController presentModalViewController:loginViewController animated:NO];
}
3) Open the app. Ensure that two view controllers are pushed on the navigation controller. Press "home" button. Reopen the app. See that viewWillDisappear is not called on the view controllers.

Using my attached sample project:
1) open the attached sample project and run the app in the simulator
2) Tap the "dismiss" button
3) Tap the "next" button
4) Press the "home" button
5) Open the app again in the simulator
6) See that viewWillDisappear is not called

Running step 2-6 multiple times, you will see that a "resource" variable is incremented in viewWillAppear: without ever being decremented in viewWillDisappear:


Expected Results: The viewWillDisappear: and viewDidDisappear: methods to be called on ViewController2

Actual Results: The viewWillDisappear: and viewDidDisappear: methods are _not_ called on ViewController2

Regression:

Notes: I filed this incident to Apple Developer Technical Support, who concluded that this was a bug. It has follow-up number 600048489. 

15-Aug-2013 09:27 AM Johan Vase:
'ModalViewCauseMissingViewDisappearCalls.zip' was successfully uploaded

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!