ios 找不到名为“MainStoryboard_iPad”的故事板
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8692971/
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 'MainStoryboard_iPad'
提问by Andreas
I cannot run my project in simulator because i get this error:
我无法在模拟器中运行我的项目,因为我收到此错误:
Could not find a storyboard named 'MainStoryboard_iPad'
找不到名为“MainStoryboard_iPad”的故事板
But the storyboard is there. Thank you
但是故事板就在那里。谢谢
回答by Daniel Lima
I managed to solve this problem in my iPad App through the following steps:
我通过以下步骤在我的 iPad 应用程序中解决了这个问题:
- Checking the Build Phases
- Editing the Info.plist file to add the option "Main storyboard file base name (iPad)"
- 检查构建阶段
- 编辑 Info.plist 文件以添加选项“主故事板文件基本名称(iPad)”
Just like in this picture:
就像这张图片:
回答by vmanjz
In my case, the iPad storyboard file was already in the project, and testing the app worked until I introduced what seems to be an unrelated bug... I fixed this by changingthe filename in xCode for the MainStoryBoard_iPad to MainStoryBoard_iPad1 and changing the TARGETS > Summary > iPad deployment Info > Main Storyboard entry. For good measure also verifying the same in -Info.plist file and Build Phases accordingly... similar to @daniel-lima.
就我而言,iPad 故事板文件已经在项目中,并且测试该应用程序一直有效,直到我引入了一个似乎无关的错误……我通过将 xCode 中 MainStoryBoard_iPad 的文件名更改为 MainStoryBoard_iPad1 并更改 TARGETS 来解决此问题> 摘要 > iPad 部署信息 > 主故事板条目。为了更好的措施,还验证 -Info.plist 文件和构建阶段中的相同内容......类似于@daniel-lima。
Hopefully, this may help others that did not fix based on above notes. This started after I fixed a CoreData related bug in a category-file. The issue was reproducible on another machine... and this fixed it on both machines.
希望这可以帮助其他没有根据上述说明修复的人。这是在我修复类别文件中与 CoreData 相关的错误之后开始的。该问题可以在另一台机器上重现......这在两台机器上都修复了它。
回答by Joseph Lennox
My issue was only on iOS 5. The resolution was found at http://need-bee.com/b/2013/08/could-not-find-a-storyboard-in-xcode-5-for-ios-5-0/
我的问题仅出现在 iOS 5 上。该解决方案位于http://need-bee.com/b/2013/08/could-not-find-a-storyboard-in-xcode-5-for-ios-5 -0/
To summarize: In Xcode, open each story board file and uncheck "Base" under localization on the right hand side. It will prompt you to move to English. Select ok. Once rebuilt my issue was resolved.
总结:在 Xcode 中,打开每个故事板文件并取消选中右侧本地化下的“Base”。它会提示您转到英语。选择确定。重建后,我的问题就解决了。
回答by Dinesh Raja
Click target and there is Mainstoryboard with textfield. Click and select your storyboard named "Mainstoryboard_iPad" and clean your project and then run it.
单击目标,有带有文本字段的 Mainstoryboard。单击并选择名为“Mainstoryboard_iPad”的故事板并清理您的项目,然后运行它。
回答by user3350296
If the failure occurs after launch, check to make sure any references to a storyboard via storyboardWithName: refers to the correct name. You may have an incorrect name hardcoded in your binary.
如果启动后发生故障,请检查以确保通过 storyboardWithName: 对故事板的任何引用都引用了正确的名称。您的二进制文件中硬编码的名称可能不正确。
In my case, I renamed the storyboard (based on a suggested workaround on stack overflow), but forgot to rename references to the storyboard in code. The symptoms were that changes to the storyboard weren't visible in the running application, but once I reset the simulator, the app stopped working completely. In that case, the old, stale copy of the storyboard was around at first and was used; once the simulator was reset, the stale copy disappeared and the "could not find a storyboard" message started appearing.
就我而言,我重命名了故事板(基于堆栈溢出的建议解决方法),但忘记在代码中重命名对故事板的引用。症状是正在运行的应用程序中看不到故事板的更改,但是一旦我重置模拟器,应用程序就完全停止工作。在那种情况下,故事板的旧的、陈旧的副本一开始就存在并被使用;一旦模拟器被重置,陈旧的副本就会消失,并且“找不到故事板”消息开始出现。
回答by Gustavo
Remove from the project all the StoryBoards and add all of them again, for me worked.
从项目中删除所有 StoryBoards 并再次添加所有这些,因为我工作了。
回答by vinhkhoa
I got this problem today as well, for me, a Product > Clean solved the problem. After that, I can rebuild the app and run it inside the Simulator without any issue.
我今天也遇到了这个问题,对我来说,产品 > 清洁解决了这个问题。之后,我可以重建应用程序并在模拟器中运行它,没有任何问题。
回答by Danny
I was encountering the same problem as in the original question but for me there wasn't really a bug - rather, the storyboard which appeared in the project navigator as "Main.Storyboard" actually had a base name of "Main" in info.plist. So my attempts to use "MainStoryboard" and "Main.Storyboard" in my code were generating a crash, but once I changed it to "Main" it worked just fine - didn't need any of the elaborate workarounds above.
我遇到了与原始问题相同的问题,但对我来说并没有真正的错误 - 相反,在项目导航器中显示为“Main.Storyboard”的故事板实际上在信息中具有“Main”的基本名称。列表。因此,我尝试在代码中使用“MainStoryboard”和“Main.Storyboard”导致崩溃,但是一旦我将其更改为“Main”,它就可以正常工作 - 不需要上面任何精心设计的解决方法。