[英]Failed to instantiate the default view controller for UIMainStoryboardFile 'Main'
I am trying to create a new Swift project and am having some issues. 我正在尝试创建一个新的Swift项目,并且遇到了一些问题。 I tried to create a new single page application but when I build I get an error saying:
我试图创建一个新的单页应用程序,但是在构建时出现错误消息:
2014-06-07 11:04:13.752 Matchismo (Swift)[2007:598021] Failed to instantiate
the default view controller for UIMainStoryboardFile 'Main' - perhaps the
designated entry point is not set?
But when I create the same single page application project with Objective-C as the language, it compiles and runs just fine. 但是,当我使用Objective-C作为语言创建相同的单页应用程序项目时,它可以编译并运行良好。 Is there some manual thing I must do in Swift to get a project up and running?
我必须在Swift中执行一些手动操作才能启动项目并运行它吗?
My understanding for this error is that I need the default view to be set, which is merely checking a box on your view controller's attributes (picture below). 我对此错误的理解是,我需要设置默认视图,这只是在视图控制器的属性上选中一个框(下图)。 I tried the solution suggested in this stackoverflow post but it didnt help and I can't find much more help on the subject with Swift being so new.
我尝试了这个 stackoverflow帖子中建议的解决方案,但它没有帮助,而且Swift这么新,我在该主题上找不到更多帮助。 Any suggestions are appreciated.
任何建议表示赞赏。
Select the ViewController Scene. 选择ViewController场景。 Now, select the inspector panel from the sidebar options.
现在,从侧栏选项中选择检查器面板。 Check the “Is Initial View Controller” attribute option, save the project and build the project again.
选中“是初始视图控制器”属性选项,保存项目并再次构建项目。
Some times it doesn't take the initial view controller.Just create a new storyboard with anyname you want and set that name into the interface in your application setting. 有时它并不需要初始的视图控制器。只需使用所需的任何名称创建一个新的故事板,然后将该名称设置为应用程序设置中的界面。
Copy paste the code from previous storyboard and run the app. 复制粘贴上一个故事板中的代码并运行该应用程序。 The application will run fine.
该应用程序将正常运行。 Dont forget tocheck the initial scene in storyboard.
不要忘记检查情节提要中的初始场景。
By following the below steps, it would work fine: 通过执行以下步骤,可以正常工作:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.