Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find a storyboard named 'Main' in bundle

I'm getting a strange error: 'Could not find a storyboard named 'Main' in bundle NSBundle' when trying to run my app on a real iOS device.

I have the file in my directory, and it works fine in the simulator. However, in the Copy Bundle Resources section, the file Main.storyboard is red.

I've tried removing it and adding it again, restarting Xcode, cleaning build, etc. with no avail. This is the warning I get in Xcode:

/Users/ajay/Documents/avx/avx/Base.lproj/Main.storyboard: Internationalization of /Users/ajay/Documents/avx/avx/Base.lproj/Main.storyboard is not available when compiling for targets before iOS 6.0
like image 521
Carpetfizz Avatar asked Oct 08 '13 05:10

Carpetfizz


People also ask

Can t find Main storyboard Xcode?

If you're missing Main. storyboard, it's probably because you forgot to change the User Interface setting to Storyboard when you created the project. If you leave it set to SwiftUI, then Main. storyboard doesn't get created.

Could not find in Main bundle?

If you get the error "Could not find a storyboard named 'Main' in bundle even after changing the "Main storyboard File base name" in the info. plist and "Main Interface" under Deployment in Target. Then you have to change another entry in the info. plist file.

How do I delete main storyboard?

Step 2: Delete the Storyboard Your new project has been created, now navigate to the left side of your interface, select the “Main. storyboard” file in the main folder, left-click and hit delete.

How do I rename a storyboard in Xcode?

Select Modeling > Storyboard from the toolbar. Right click on the storyboard to rename and select Rename Storyboard… from the popup menu. Click OK to confirm the new name.


9 Answers

open the info.plist of your project and remove the selected row displayed in screenshotenter image description here

If you get a black screen ensure your new initial storyboard is selected as your main interface enter image description here

For 2021...

You must also edit UIApplicationSceneManifest. See the more recent answers below.

like image 117
Kalpit Gajera Avatar answered Oct 12 '22 10:10

Kalpit Gajera


For anyone facing this issue on Xcode 11, here's how you fix it if you face this issue when doing storyboard less project setup

(Adding some parts that ricardopereira missed)

1) First, delete the Main.storyboard file

2) Next, go to PROJECT_NAME -> GENERAL

In main interface drop-down, delete the text Main

removing reference to main from general settings

3) Now go to info.plist and delete Storyboard Name

removing reference to the storyboard from info.plist

4) Finally, modify scene(_:willConnectTo:options) code in the file SceneDelegate.swift (Yes! It's not in App Delegate anymore.)

var window: UIWindow?       func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {         // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.         // If using a storyboard, the `window` property will automatically be initialized and attached to the scene.         // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).         guard let windowScene = (scene as? UIWindowScene) else { return }         window = UIWindow(frame: windowScene.coordinateSpace.bounds)         window?.windowScene = windowScene         window?.rootViewController = ViewController()         window?.makeKeyAndVisible()     } 

You can also refer to this video instead: https://www.youtube.com/watch?v=Htn4h51BQsk

like image 44
Parth Tamane Avatar answered Oct 12 '22 11:10

Parth Tamane


You may check the target membership of the storyboard. May be there is where the problem is:

It should be looking like this:

Target Membership

like image 22
Geekoder Avatar answered Oct 12 '22 10:10

Geekoder


An update for applications created for iOS 13.0 and above. (Xcode 11)

If you get the error "Could not find a storyboard named 'Main' in bundle even after changing the "Main storyboard File base name" in the info.plist and "Main Interface" under Deployment in Target.

Then you have to change another entry in the info.plist file.

  1. Open the info.plist file.
  2. Expand "Application Scene Manifest".
  3. Expand "Scene Configuration".
  4. Expand the item 0 under "Application Sessions Role" and then change the storyboard name there.

enter image description here

And your application will start working.

like image 24
Shubham Avatar answered Oct 12 '22 10:10

Shubham


In a project that uses UIScene in iOS 13 and Xcode 11, you need to remove the UISceneStoryboardFile key from the .plist.

Xcode 11:

xcode11-uiscene

Changing directly from the file:

uiscene-plist

like image 23
ricardopereira Avatar answered Oct 12 '22 11:10

ricardopereira


I deleted the app from my phone, did Product-->Clean, and loaded it again. That's all it took for me.

like image 36
user1021430 Avatar answered Oct 12 '22 12:10

user1021430


I got this error, however, it was my intention to remove storyboards completely.

Removing the 'Main Storyboard file base name' key from my plist cured the error.

like image 38
kraftydevil Avatar answered Oct 12 '22 10:10

kraftydevil


Could not find a storyboard named 'Main' in bundle

Reason I could think of:

As far as my iOS knowledge concluded me, this was just happened because the XCode was unable to find the reference to the Main.storyboard file within my project directory to copy it into the App.

Resolution:

  1. Selected the Main.storyboard file and tried to delete, and from the dialog that pops up as follows: enter image description here

  2. Clicked "Remove Reference" button.

  3. Then, from the actual place where I could find the Main.storyboard file within the project directory, dragged, and dropped to the XCode, and again from the dialog that pops up as follows: enter image description here

  4. I choosed, "Create folder references" (because that's one thing I intended to do because I've changed my project's file and folder structure). But most of the times choosing "Create groups" also might work. And clicked on "Finish" button. My Storyboard files were already within as shown in the screenshot already within a Base.lproj directory as follows:

    enter image description here

    Note: One important thing to remind here at this step is, don't forget to tick it ON the checkbox "Add to targets" to your app.

  5. Clean the Product, re-build, and if it is successful, most of the time try running it will be successful.

Hope this might be helpful to somebody else out there! I tried this on XCode 7.3.1 and on iOS Sim 9.3 and iPhone 6S!

like image 20
Randika Vishman Avatar answered Oct 12 '22 12:10

Randika Vishman


Follow the steps:

1) First Click your story board

2) Then Click File Inspector

3) Then select "Target Membership"

Screen Shot

like image 26
Vicky Avatar answered Oct 12 '22 12:10

Vicky