Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to instantiate the default view controller for UIMainStoryboardFile 'Main'

I am trying to create a new Swift project and am having some issues. 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. Is there some manual thing I must do in Swift to get a project up and running?

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. Any suggestions are appreciated.

My main view controller

Screenshot for error

like image 964
jaredsmith Avatar asked Jun 07 '14 18:06

jaredsmith


3 Answers

Select the ViewController Scene. 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.

like image 119
user6919809 Avatar answered Oct 31 '22 23:10

user6919809


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.

like image 34
Shane Avatar answered Oct 31 '22 22:10

Shane


By following the below steps, it would work fine:

  1. Select the Scene which is the type of ViewController/UICollectionViewController in Main.storyboard.
  2. Select the Attribute Inspector in the right sidebar.
  3. Click/Check the “Is Initial View Controller” attribute.
  4. Re-Run of the project and this should solve the issue.
like image 28
Deepak Singhvi Avatar answered Oct 31 '22 21:10

Deepak Singhvi