Could not find a storyboard named 'Main' in bundle

IphoneIosObjective CXcode

Iphone Problem Overview


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

Iphone Solutions


Solution 1 - Iphone

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.

Solution 2 - Iphone

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

  1. Now go to info.plist and delete Storyboard Name

removing reference to the storyboard from info.plist

  1. 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

Solution 3 - Iphone

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

Solution 4 - Iphone

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.

Solution 5 - Iphone

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

Solution 6 - Iphone

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

Solution 7 - Iphone

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.

Solution 8 - Iphone

#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.

  1. 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!

Solution 9 - Iphone

Follow the steps:

  1. First Click your story board

  2. Then Click File Inspector

  3. Then select "Target Membership"

Screen Shot

Solution 10 - Iphone

The simulator is not case sensitive, but the device is. If your storyboard is called MainStoryboard, not MainStoryBoard, this will cause your problem. and aslo

  • dont use the extensions write only the story board name

main.storyboard -> only main is the storyboard name

Solution 11 - Iphone

Swift 5.1 & xCode 11.2

In my case, I forgot to change Storyboard Name in Info.plist

enter image description here

Info.plist source code

	<dict>
		<key>UIApplicationSupportsMultipleScenes</key>
		<false/>
		<key>UISceneConfigurations</key>
		<dict>
			<key>UIWindowSceneSessionRoleApplication</key>
			<array>
				<dict>
					<key>UISceneConfigurationName</key>
					<string>Default Configuration</string>
					<key>UISceneDelegateClassName</key>
					<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
					<key>UISceneStoryboardFile</key>
					<string>AccountViewController</string>
				</dict>
			</array>
		</dict>
	</dict>

Solution 12 - Iphone

Also, try removing the Storyboard name

enter image description here

Solution 13 - Iphone

  1. Open you storyboard file
  2. Then Click File Inspector
  3. Then select "Target Membership" and check your project
  4. Do the same for ViewController file !!!important part if you use ViewController.swift or ViewController.m with your storyboard!!!

Solution 14 - Iphone

This error come, while you recover your main.storyboard file from trash after delete your file. I also faced same issue yesterday.

You have to set the location path of the main.storyboard as Relative to Group in file inspector of main.storyboard. After that in the same attribute, you have to insure the check mark on your app target(As you can see in attached picture).

enter image description here

Solution 15 - Iphone

Two different solutions that worked for me after upgrading to Xcode 10.1:

  • In File->Workspace (or Project) Settings. Switch to Legacy Build System.

  • In your targets Build Phases, remove the Base.lproj folder from Copy Bundle Resources (if listed) and make sure each of your storyboards are listed and copied separately instead.

After applying either of the fixes above make sure you Clean Build Folder from the Product menu once, otherwise the fixes might not work properly.

Solution 16 - Iphone

Deleting row in plist caused black screen in my app too. And I fixed it by enabling target membership of the storyboard

Solution 17 - Iphone

As Kalpit Gajera has said, "open the info.plist of your project and remove the selected row displayed in screenshot". You simply remove 'Main storyboard file base name' from the Info.plist. After you remove it, clean and run, the program will no longer fail but will show a black screen. Open Info.plist again and manually add the row back in. Problem solved.

Solution 18 - Iphone

If still you have black screen, then try adding below code in your scene delegate

willConnectTo

    guard let windowScene = (scene as? UIWindowScene) else { return }
    window = UIWindow(frame: windowScene.coordinateSpace.bounds)
    window?.windowScene = windowScene
    let navController = UINavigationController()
    let mainstoryboard:UIStoryboard = UIStoryboard(name: "Your storyboard name", bundle: nil)
    let initialController = mainstoryboard.instantiateViewController(withIdentifier: "your initial controller Identifier") as! initialController
    navController.addChild(initialController)
    window?.rootViewController = navController
    window?.makeKeyAndVisible()

Solution 19 - Iphone

choose main.storyboard, change the view as iOS 6.1 and earlier, then xcode will tell u what u need to do.

enter image description here

Solution 20 - Iphone

My solution is:

When i added a Seque Connection between two Views and in the Projekt Configuration the Deployment Target is less then 8.0 i get this error.

ok, easy understanding when you develop for IOS 6.0 (for example) you can't use Seque, because the Seque needs IOS 8.0 or later...... ;-)

so, i set the Deployment Target to 8.0 and the error is gone !!!! other while, i cancel all the Segue Connections and handle it with IBAction, old school ;-)

Solution 21 - Iphone

I was moving Main.Storyboard file to "blue" sub folder which was causing issues, I had to add sub folders following these instructions https://stackoverflow.com/questions/29664278/xcode-6-3-new-file-issue

then moving Main.Storyboard file to yellow sub folder did work for me

Solution 22 - Iphone

My issue was resolved by removing the .xml suffix from the Main.storyboard.xml file.

Apparently, the suffix changed from the version from which I imported the project.

Therefore, renaming the file (removing the .xml suffix) and restarting, then Project-> clean.... fixed the problem.

Solution 23 - Iphone

If your storyboard is added in project (which you'll determine from Project File Inspector section of xcode utility area)Check box is marked in target membership area

You just have to remove Main.Storyboard from "Copy bundle resource" (in Build Phase) and add it again in "Copy bundle resource". This was worked for me.enter image description here

Solution 24 - Iphone

Ok this has been a process. Trying so many different things. Running xcode 6.4 on OS 10.11. Having the cannot find 'Main' problem. What I finally did was move the main.storyboard off on too my desktop from Finder.Did a clean and build and quit xcode. restarted xcode now it has a red main.storyboard. i run it virtually does the same thing. then I right click on the project folder and choose the option add files to... Browse to where it is and open it. then when it is there to the right should be the identities inspector. click on the small folder under location. browse to that folder again and select choose. Then I ran and it worked. Amen !!!

Solution 25 - Iphone

Select the view controller you want to first show up in the list on the left side of the storyboard, then in the attribute inspector make sure its title is "Main" and the checkbox for "Is Initial View Controller" is selected.

Solution 26 - Iphone

In my case this was due to a Pod library that was outdated

Deleting the /Pods folder and doing pod install fixed it for me

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionCarpetfizzView Question on Stackoverflow
Solution 1 - IphoneKalpit GajeraView Answer on Stackoverflow
Solution 2 - IphoneParth TamaneView Answer on Stackoverflow
Solution 3 - IphoneGeekoderView Answer on Stackoverflow
Solution 4 - IphoneShubhamView Answer on Stackoverflow
Solution 5 - IphonericardopereiraView Answer on Stackoverflow
Solution 6 - Iphoneuser1021430View Answer on Stackoverflow
Solution 7 - IphonekraftydevilView Answer on Stackoverflow
Solution 8 - IphoneRandika VishmanView Answer on Stackoverflow
Solution 9 - IphoneVickyView Answer on Stackoverflow
Solution 10 - Iphoneuser2580666View Answer on Stackoverflow
Solution 11 - IphonenomnomView Answer on Stackoverflow
Solution 12 - IphoneNeha VipinView Answer on Stackoverflow
Solution 13 - Iphoneuser1195202View Answer on Stackoverflow
Solution 14 - Iphonesaumya ranjan GangwarView Answer on Stackoverflow
Solution 15 - IphoneLentoManView Answer on Stackoverflow
Solution 16 - Iphoneseashore liuView Answer on Stackoverflow
Solution 17 - IphoneMavin MartinView Answer on Stackoverflow
Solution 18 - IphoneSagar ThukralView Answer on Stackoverflow
Solution 19 - IphoneChrisView Answer on Stackoverflow
Solution 20 - IphoneSven VietenseView Answer on Stackoverflow
Solution 21 - IphoneAqib MumtazView Answer on Stackoverflow
Solution 22 - IphoneCraig DView Answer on Stackoverflow
Solution 23 - IphoneSk Borhan UddinView Answer on Stackoverflow
Solution 24 - IphoneiSpeedyGView Answer on Stackoverflow
Solution 25 - IphoneAkashascossetView Answer on Stackoverflow
Solution 26 - IphoneKerakView Answer on Stackoverflow