0

I have a storyboard file that I want to use as my launch screen. I have set the ViewController in that storyboard to be the initial one.

I've also set the launch screen like so:

enter image description here

Here's the code I have in my SceneDelegate for selecting the first ViewController to show the user:

self.window = UIWindow(frame: UIScreen.main.bounds)
let vc = storyboard.instantiateViewController (withIdentifier: "Channels") as! UINavigationController
window = UIWindow(windowScene: windowScene)
window?.rootViewController = vc
window?.makeKeyAndVisible()

I see the launch screen upon first starting the app, then a black screen; and then finally my user interface.

HangarRash
  • 7,314
  • 5
  • 5
  • 32
narner
  • 2,908
  • 3
  • 26
  • 63

3 Answers3

2

check if "is Initial Viewcontroller" is selected for the ViewController in your story board. See this screenshot

  • 1
    welcome to Stack Overflow. `Initial Viewcontroller` stands for `rootViewController` it's already set in code. – jatin fl Jul 07 '21 at 04:53
  • @jatinfl rootViewController and Initial ViewController are separate. The Initial View Controller refers to a Storyboard's initial ViewController https://stackoverflow.com/questions/25252467/in-ios-is-the-initial-view-controller-always-the-same-as-the-root-view-controlle – froggomad Jul 07 '21 at 06:43
  • @froggomad yeah i know that but while you set rootview controller with code it will ignore initial view controller from storyboard. – jatin fl Jul 07 '21 at 06:50
  • It doesn't actually get ignored, there are 2 root viewControllers in play and the Initial ViewController may be displayed briefly as it's set as the key window's rootViewController. I've seen this behavior plenty when I use the window's root view controller to display authentication screens instead of going to the storyboard's initial view controller – froggomad Jul 07 '21 at 07:11
1

Sounds like you have an initial view controller somewhere that doesn't have a background color. I would recommend going through your storyboard and checking to see if you have a "is Initial ViewController" boxed checked in your panel on the right.

is Initial View Controller

0

I have Structured project files and moved info.plist in "RequiredFiles" folder.

But in Build Settings info.plist path was "ProjectName/Info.plist". I changed it to "ProjectName/RequiredFiles/Info.plist"

This solved my problem hopefully it will solve for others too....

Sudhanshu.B
  • 626
  • 9
  • 22