iOS 13 UIWindowScene Black Screen

September 21, 2019

I've encountered this bug enough times that I figured it was time to write a quick post about it. If you've looked into multiple window support for your app in iOS 13, you might know that a lot of the setup you used to have to do in the app delegate now lives in the scene delegate instead.

However, multiple times now, I've thought I've set everything up correctly (scene delegate class implemented, configuration with delegateClass set properly, correct Info.plist setup, etc), only to get a black screen on launch.

The secret is this: prior to iOS 13, it was common to set up your UIWindow with the bounds of the screen:

// Does not work in iOS 13+
window = UIWindow(frame: UIScreen.main.bounds)

This breaks when using the UISceneSession system. Instead, you have to initialize the window with the scene itself, in your scene(scene:willConnectTo:options:) method:

window = UIWindow(windowScene: windowScene)

This has generally been the missing piece I forgot, and ends up resolving the black screen issue. Here's a concrete example.

Picture of me with a corgi

Noah Gilmore

Hello! I'm Noah, a software developer based in the San Francisco bay area. I focus mainly on iOS, Apple platform development, and full stack web development.

  • 💻 I'm writing a macOS editor for Atlassian Confluence called Fluency
  • 📱 I wrote an app which lets you create transparent app icons called Transparent App Icons
  • 🧩 I made a puzzle game for iPhone and iPad called Trestle
  • 🎨 I wrote a CoreImage filter utility app for iOS developers called
  • 👋 Please feel free to reach out on Twitter