Split view controller on iOS 13 never dealloc detail controller

Hi!


I found a situation where a split view controller on iOS 13 never let the controller displayed in the detail to dealloc.


The problem is reproducible with the standard Xcode “Master-Detail App” project template.


This is how you can reproduce the problem:


  • In Xcode create a new “Master-Detail App” project.
  • In “DetailViewController” add a deinit method and print something.
  • Run the project on a device that allows you to switch from a compact split view to an expanded split view (for example the iPhone 8 Plus).
  • Set the device to portrait.
  • If you choose an item on the master list the detail is loaded and you will see that the previously controller that was present on the detail is deallocated. That’s correct.
  • Now rotate the device to landscape to expand the split view.
  • Choose an item in the master. The controller will be displayed on the detail.
  • Rotate the device to portrait. The split view will collapse.
  • Tap on the back arrow (that for some strange reason on iOS 13 will no more display the title but only the arrow icon, but that’s another problem).
  • Choose another item on the master.
  • The previous controller will never be deallocated and will stay in memory forever.


If you try the same thing on iOS 12 you will see that everything is working as expected.


Had any of you already noticed this? If yes, have you found a way to fix the problem?


Thank you


Alan

Split view controller on iOS 13 never dealloc detail controller
 
 
Q