I am using Xcode 5 in a newly created app and when I just create it I go for the run button e click on it, then the project gets built but it does not show in the iOS Simula
This warning is also reported if you have some code like:
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window?.rootViewController = myAwesomeRootViewController
window?.makeKeyAndVisible()
In this case, go to the first page of target settings and set Main Interface
to empty, since you don't need a storyboard entry for your app.
Apart from above correct answer, also make sure that you have set correct Main Interface in General.
Check Is Initial View Controller in the Attributes Inspector.
1st option
if you want to set your custom storyboard instead of a default view controller.
Change this attribute from info.plist file
<key>UISceneStoryboardFile</key>
<string>Onboarding</string>
Onboarding would be your storyboard name
to open this right-click on info.plist file and open as a source code
2nd option
1- Click on your project
2- Select your project from the target section
3- Move to Deployment interface section
4- Change your storyboard section from Main Interface field
Please remember set your storyboard initial view controller
Using Interface Builder :
Check if 'Is initial view controller' is set. You can set it using below steps :
If you have done this step and still getting error then uncheck and do it again.
Using programmatically :
Objective-C :
self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *viewController = [storyboard instantiateViewControllerWithIdentifier:@"HomeViewController"]; // <storyboard id>
self.window.rootViewController = viewController;
[self.window makeKeyAndVisible];
return YES;
Swift :
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
var objMainViewController: MainViewController = mainStoryboard.instantiateViewControllerWithIdentifier("MainController") as! MainViewController
self.window?.rootViewController = objMainViewController
self.window?.makeKeyAndVisible()
return true
First click on the View Controller in the right hand side Utilities bar. Next select the Attributes Inspector and make sure that under the View Controller section the 'Is Initial View Controller' checkbox is checked!