Could not find a storyboard named 'main' in bundle NSBundle

What does this error mean?

"Could not find a storyboard named 'main' in bundle NSBundle"

Answered by OOPer in 346364022

Isn't the message clear enough?

Your app tried to find a storyboard named 'main', but could not find it in the spedified NSBundle.

The bundle may very likely be your app bundle.

Thus, your app does not contain main.storybord even though some parts of your code trying to access it.


A storyboard `main.storyboard` is not includeded in usual app template. (Usual app template uses `Main.storyboard` not `main.storyboard`.)

Find where in your code or settings your app trying to access that.

Accepted Answer

Isn't the message clear enough?

Your app tried to find a storyboard named 'main', but could not find it in the spedified NSBundle.

The bundle may very likely be your app bundle.

Thus, your app does not contain main.storybord even though some parts of your code trying to access it.


A storyboard `main.storyboard` is not includeded in usual app template. (Usual app template uses `Main.storyboard` not `main.storyboard`.)

Find where in your code or settings your app trying to access that.

Thank you for your answer.

I am new to swift and xcode so I couldn't get immediately.


The problem was in this line:

let mainStoryBoard = UIStoryboard(name: "main", bundle: Bundle.main)

so I changed it to:

let mainStoryBoard = UIStoryboard(name: "Main", bundle: Bundle.main)

and it worked!

Could not find a storyboard named 'main' in bundle NSBundle
 
 
Q