viewWillTransitionToSize:withTransitionCoordinator: called when app goes into the background or inactive

Originator:srdan.rasic
Number:rdar://23010208 Date Originated:07-Oct-2015
Status:Open Resolved:
Product: Product Version:
Classification: Reproducible:
 
Summary:
It appears that the method viewWillTransitionToSize:withTransitionCoordinator: gets called multiple times when the app goes into the background or inactive since iOS 9.

Our application logic depends on the screen size and changes to the screen size trigger tasks that update our model with regard to the new size. We need to do this when user rotates the device or goes into multitasking mode (split view), but we must not do it when user goes into the background.

One idea was to use UIApplicationWillResignActiveNotification notification, but that turned out to be mission impossible because sometimes viewWillTransitionToSize:withTransitionCoordinator: gets called before the notification is sent and othertimes it gets called after the notification is sent :/


Steps to Reproduce:
For example, if the app is in the portrait on iPad, pressing the home button will cause the app to receive method call first with size of 1024x768 (landscape) and then with 768x1024 (back to portrait). That leads me to conclude that iOS does this in order to get screenshots for app switcher.


Expected Results:
It would be great if we could know whether the screen size was really a result of user interaction or a result of internal system requirements.

Actual Results:
--

Version:
iOS 9.0 and above

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!