UINavigationControllerDelegate.navigationController(_:didShow:animated:) called twice

Originator:Pierre.Felgines
Number:rdar://44966342 Date Originated:03/10/2018
Status:Open Resolved:
Product:Simualtor Product Version:iOS12
Classification:UIKit Reproducible:Yes
 
Summary:

There is an issue when displaying a navigation controller with a rootViewController as the window's rootViewController.

Steps to Reproduce:

Create a navigationController. Set it a delegate and use it as window rootViewController. When displaying the navigationController rootViewController, the method `UINavigationControllerDelegate.navigationController(_:didShow:animated:)` is called twice instead of once.
There is a sample project attached that highlights the bug.

In the AppDelegate.swift, comment or uncomment the two methods `testWithBug` `testWithoutBug` to see the differences in the logs.

Expected Results:

The method `UINavigationControllerDelegate.navigationController(_:didShow:animated:)` should be called once.

Actual Results:

The method `UINavigationControllerDelegate.navigationController(_:didShow:animated:)` is called twice.


Version/Build:

iOS 12.0
iPhone SE (Simulator)


Configuration:

Debug

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!