简体   繁体   English

无法在捆绑包中找到名为“Main”的故事板,Xcode 7

[英]Could not find a storyboard named 'Main' in bundle, Xcode 7

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". 升级到XCode 7后,我的项目遇到了麻烦。当我运行时,我收到一个错误,“由于未捕获的异常终止应用程序'NSInvalidArgumentException',原因:'无法在捆绑NSBundle中找到名为'Main'的故事板”。 My storyboard name is Main.storyboard. 我的故事板名称是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. 到目前为止,我已尝试过以下内容。

  1. Removing the reference to the storyboard in the info.plist file. 删除info.plist文件中对storyboard的引用。 When I do this the app does start but I get a black screen as it doesn't load the storyboard. 当我这样做时,应用程序确实启动但我得到一个黑屏,因为它没有加载故事板。
  2. Fiddle with the Target Membership Main.storyboard. 摆弄Target Membership Main.storyboard。
  3. Remove the storyboard from the project, clean, run and then adding the storyboard back again. 从项目中删除故事板,清理,运行,然后再次添加故事板。
  4. Uninstall Xcode, reinstall Xcode. 卸载Xcode,重新安装Xcode。
  5. Deleting the Derived Data folder. 删除派生数据文件夹。
  6. Loading the Storyboard manually with code such as UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]]; 使用UIStoryboard * storyboard = [UIStoryboard storyboardWithName:@“Main”bundle:[NSBundle mainBundle]]等代码手动加载Storyboard

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. 我希望避免这种情况。

My projects info.plist file 我的项目info.plist文件

Can you tried 你能试试吗?

Select Target - > General -> Deployment info - > Main interface "Choose your Storyboard name" 选择目标 - > 常规 - > 部署信息 - > 主界面 “选择您的故事板名称”

May this help you 愿这对你有所帮助

Try this, 试试这个,

Please Check Target Membership in your file inspector. 请在文件检查器中检查目标成员身份。

Its working for me. 它为我工作。

If you use the same code as follow 如果您使用相同的代码如下

UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];

then just change [NSBundle mainBundle] to nil and my problems with simulator reinstalls are disappeared. 然后只需将[NSBundle mainBundle]更改为nil ,我的模拟器重新安装问题就消失了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Xcode 11 在捆绑包 NSBundle 中找不到名为“Main”的 storyboard - Xcode 11 Could not find a storyboard named 'Main' in bundle NSBundle 在捆绑包中找不到名为“Main”的 storyboard - Could not find a storyboard named 'Main' in bundle 不使用故事板时,Xcode 在捆绑 NSBundle 中找不到名为“Main”的故事板 - Xcode Could not find a storyboard named 'Main' in bundle NSBundle when not using storyboards Xamarin IOS:在捆绑包NSBundle中找不到名为“ Main”的故事板 - Xamarin IOS: Could not find a storyboard named 'Main' in bundle NSBundle Xcode 7无法找到名为的故事板 - Xcode 7 Could not find a storyboard named 无法在捆绑NSBundle中找到名为“Storyboard.storyboard”的故事板 - Could not find a storyboard named 'Storyboard.storyboard' in bundle NSBundle 在捆绑包NSBundle中找不到名为“ MainStoryBoard”的情节提要 - Could not find a storyboard named 'MainStoryBoard' in bundle NSBundle “无法在捆绑NSBundle中找到名为'MainStoryboard'的故事板” - “Could not find a storyboard named 'MainStoryboard' in bundle NSBundle” 找不到在捆绑 NSBundle 中命名的故事板 - Could not find a storyboard named in bundle NSBundle 在 Flutter 中的捆绑包 NSBundle 中找不到名为“NSPhotoLibraryUsageDescription”的 storyboard - Could not find a storyboard named 'NSPhotoLibraryUsageDescription' in bundle NSBundle in Flutter
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM