viewWillTransition:ToSize erroneously called when app moved to background

Originator:hotngui
Number:rdar://34919427 Date Originated:10/10/2017
Status:Open Resolved:
Product:UIKit Product Version:iOS 10, iOS 11
Classification:Serious Bug Reproducible:Yes
 
Area:
UIKit

Summary:
When an app is moved to the background its view controllers are having their viewWillTransition:ToSize methods called. In fact, called twice. 

There is no reason for either of these calls at this point in the lifecycle and leads to confusion if one's code where dependent on the view to be attached to a window, which it is not at this point in the method.

Steps to Reproduce:
Build the attached sample project; run it; put the app in the background. Observe the logging output showing the method was called twice at that time after the app is in the background.

Expected Results:
No calls to the method - should be called only when the app is brought into the foreground and if the size actually changed.

Actual Results:
Method is called twice

Version/Build:
iOS 10, iOS 11

Configuration:
I tested on an iPad, and iPad simulator.

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!