在捆绑包中找不到名为“Main”的故事板,Xcode 7
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35463451/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Could not find a storyboard named 'Main' in bundle, Xcode 7
提问by Mark S
I'm having troubles with my project after upgrading to XCode 7. When I run I get an error, "Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Could not find a storyboard named 'Main' in bundle NSBundle". My storyboard name is Main.storyboard.
升级到 XCode 7 后,我的项目遇到了问题。运行时出现错误,“由于未捕获的异常‘NSInvalidArgumentException’而终止应用程序,原因:‘在捆绑 NSBundle 中找不到名为‘Main’的情节提要”。我的故事板名称是 Main.storyboard。
If I clean my project it runs just fine. I must clean each time I run or I will get the above error.
如果我清理我的项目,它运行得很好。每次运行都必须清理,否则会出现上述错误。
If found a number of postings with this same error. The various remedies seem to randomly help some people but not others. So far I have tried the following.
如果发现许多帖子都出现了同样的错误。各种补救措施似乎随机地帮助了一些人,而不是其他人。到目前为止,我已经尝试了以下方法。
- Removing the reference to the storyboard in the info.plist file. When I do this the app does start but I get a black screen as it doesn't load the storyboard.
- Fiddle with the Target Membership Main.storyboard.
- Remove the storyboard from the project, clean, run and then adding the storyboard back again.
- Uninstall Xcode, reinstall Xcode.
- Deleting the Derived Data folder.
- Loading the Storyboard manually with code such as UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
- 删除 info.plist 文件中对故事板的引用。当我这样做时,应用程序确实启动了,但我得到了一个黑屏,因为它没有加载故事板。
- 摆弄目标成员资格 Main.storyboard。
- 从项目中删除故事板,清理,运行,然后再次添加故事板。
- 卸载 Xcode,重新安装 Xcode。
- 删除派生数据文件夹。
- 使用代码手动加载 Storyboard,例如 UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
When I load the storyboard manually it crashes with the same messages as autoloading it.
当我手动加载故事板时,它会崩溃并显示与自动加载相同的消息。
I saved a copy of my working XCode 6 project before the upgrade and after fussing so much with my project I have tried using a fresh copy of the XCode 6 project that was working but this didn't help.
我在升级之前保存了我的工作 XCode 6 项目的副本,在对我的项目大惊小怪之后,我尝试使用正在工作的 XCode 6 项目的新副本,但这没有帮助。
I've seen a number of posts about this problem where the person just gave up and rebuilt their project from scratch. I'm hoping to avoid this.
我看过很多关于这个问题的帖子,其中这个人只是放弃并从头开始重建他们的项目。我希望避免这种情况。
回答by Kamlesh Shingarakhiya
Can you tried
你能试试吗
Select Target- > General-> Deployment info- > Main interface"Choose your Storyboard name"
选择Target-> General-> Deployment info-> Main interface"Choose your Storyboard name"
May this help you
可能这对你有帮助
回答by vijay
Try this,
尝试这个,
Please Check Target Membership in your file inspector.
请在您的文件检查器中检查目标成员资格。
Its working for me.
它对我来说有效。
回答by WINSergey
If you use the same code as follow
如果您使用以下相同的代码
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
then just change [NSBundle mainBundle]
to niland my problems with simulator reinstalls are disappeared.
然后只需更改[NSBundle mainBundle]
为nil,我的模拟器重新安装问题就消失了。