Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Applications are expected to have a root view controller at the end of application launch disaplying in console

I am getting "Applications are expected to have a root view controller at the end of application launch" statement in console while application is not opening after displaying splash screen. my application:didFinishLaunchWithOptions method is:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:[NSBundle mainBundle]];
UIViewController *initViewController = [storyboard instantiateViewControllerWithIdentifier:@"FirstInfo"];

[self.window setRootViewController:initViewController];
[self.window makeKeyAndVisible];
[self.window makeKeyWindow];
return YES;

main.m is as:

int main(int argc, char *argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));

    }
}

The application was previously working fine. It is just a quick not functioning from Today. I am using ARC and Storyboard in the application. Please Suggest.

like image 715
Arvind Avatar asked Sep 19 '12 12:09

Arvind


2 Answers

Make sure that the controller being returned from the storyboard is not nil.

Edit While you are at it...where do you create self.window ?

like image 36
borrrden Avatar answered Sep 21 '22 11:09

borrrden


add a "MainStoryboard" into your project, and set Main Storyboard option in build settings as "MainStoryboard"

then, update the AppDelegate method:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
return YES;
}

It works.

like image 66
yaodong Avatar answered Sep 20 '22 11:09

yaodong