viewWillTransition(to:with:) is called when a view is not loaded yet on iPad split-screen

Number:rdar://37073110 Date Originated:January 31 2018, 5:19 PM
Status: Resolved:
Product:iOS + SDK Product Version:
Classification: Reproducible:Always

`viewWillTransition(to:with:)` is called before a UIViewController's view is loaded if an app is starting up in split screen mode on iPad. If this UIViewController is the app's initial one, was instantiated from storyboard and this method has any logic touching outlets (which are implicitly unwrapped optionals by default), the app will crash.
The bug is kind of severe, because if an app crashes on launch, the user might need to know how to de-couple it from another app in split-screen before it could be launched again.

Steps to Reproduce:
iOS 10:
- do split screen with other app
- press home on device
- launch task manager and kill the app
- launch it again

iOS 11 (there is no way to kill split-screen app separately but there is a way):
- make sure your app asks for photo/camera permissions
- do split screen with other app
- approve photo access
- go to, revoke photo permissions
- launch the app again (because it was killed when changing permissions)

Expected Results:
- observe the app launching in split screen mode and not crashing

Actual Results:
- the app crashes

iOS 10, iOS 11 up to 11.2.5 at the moment of reporting.

iPad supporting split screen


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at 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!