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

前端 未结 27 2566
感动是毒
感动是毒 2020-12-02 15:41

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 build

相关标签:
27条回答
  • 2020-12-02 15:54

    I had this problem in a project that had storyboards with and without ~iPad or ~iPhone suffixes, like MainStoryboard.storyboard and MainStoryboard~iPad.storyboard.

    The problem was that MainStoryboard.storyboard was overwriting MainStoryboard~iPad.storyboard when it got compiled into the build directory. If the files were compiled in the opposite order, both would be preserved without issue. I have no idea why this happens.

    To get around this, you can stop using ~iPad/iPhone suffixes or make sure the files are in the right order in the Copy Bundle Resources phase.

    (Using XCode6.2beta2)

    0 讨论(0)
  • 2020-12-02 15:57

    This problem happened for me when i was calling storyboard in code.The reason was i used different 'word' for storyboard.I solved it like this

    Go to Targets ->info , select info,copy name of storyboard and paste it to where you are calling storyboard.

    At least give a try….

    0 讨论(0)
  • 2020-12-02 15:58

    This helped me (Swift 2.1, Xcode 7.2) for an app with a tab bar

        let storyboard: UIStoryboard = UIStoryboard(name:"Main",bundle: NSBundle(forClass: self.dynamicType))
        let tabController = storyboard.instantiateViewControllerWithIdentifier("MyTabBarIdentifier") as! UITabBarController
    

    I had the Main.storyboard with the correct target membership, copy bundle resources, cleaned build folder, etc (most of the answers were pointing to this).

    0 讨论(0)
  • 2020-12-02 15:58

    To prevent this from happening I have had to change the way I work with storyboard files. After editing the storyboard save the file then exit XCode. This seems to prevent the problem from occurring.

    0 讨论(0)
  • 2020-12-02 15:59

    You just need to check your configuration file (.plist) under Supporting files folder

    Check the name of your default storyboard.

    0 讨论(0)
  • 2020-12-02 16:00

    Just want to mention scenario I encountered. I don't know how, but storyboard disconnected from the target although it still was part of the project. To fix this I opened storyboard, selected "File Inspector"(leftmost icon on the right panel) and check the project under "Target membership". Hope it helps someone.

    0 讨论(0)
提交回复
热议问题