Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I have started a new app a few days ago and began working with the simulator to test it. I started as an empty project and manually added the storyboard. The simulator builds and runs my app just fine but when I try to build to my iPhone I get the messsage 'Could not find a storyboard named 'MainStoryBoard' in bundle NSBundle'.

Google turned up nothing and this question suggested I checked my target for the storyboard, but everything is in place. Even so, if something wouldn't be in place, the simulator wouldn't run either.

Can anyone point me in the right direction?

like image 474
chriskievit Avatar asked Jan 01 '12 18:01

chriskievit


People also ask

Why is Main storyboard not showing up in Xcode?

You have SwiftUI enabled in your project, which does not use storyboards anymore. Your layout is inside the ContentView. swift file. If you do want to work the old way, with storyboards, you should uncheck 'Use SwiftUI' in the project creation screen.

Where is the main storyboard in Xcode?

If you're using XCode 11.4. 1, try to find LaunchScreen. storyboard instead in the project navigator.

Where is the main storyboard in Xcode 11?

there is a key in plist file and under "Targets" -> Custom iOS Target Properties "Main storyboard file base name". There default is "Main". So if you want any other storyboard, replace "Main" with your file name. By selecting storyboard from main interface, in plist, it automatically changed.

How do I open the main storyboard source code?

If you go over to the project outline and control click on the storyboard file and hold down the cursor, you will see the option to open as, this will let you open the storyboard as a certain type. Click on that and choose open as story board. Good luck!


1 Answers

I had my app working normally on the iPhone Simulator but strangely Xcode stopped responding and i had to Force Quit Xcode. When I restarted Xcode i encountered "Could not find a storyboard named MainStoryboard....",

I have fixed this issue by following below steps:

  1. Renaming "MainStoryboard.storyboard" to "MainStoryboard_1.storyboard"
  2. Open file "$your_app$-Info.plist" located in "Supporting Files" folder. Edit "Main storyboard file base name" to "MainStoryboard_1.storyboard".
  3. Rerun the app, and it worked for me.
  4. I renamed my storyboard file back to its original "MainStoryboard.storyboard".
  5. Edited the .plist file back to its original.
  6. Rerun the app, and it worked for me.

For some reason the file "MainStoryboard.storyboard" was not recognised after force quitting Xcode and following above steps made the app recognise the file back again.

Hope this solution helps..

like image 124
Sushma Satish Avatar answered Sep 22 '22 15:09

Sushma Satish