0

Possible Duplicate:
Applications are expected to have a root view controller at the end of application launch

My app uses uitabbarcontroller and several navigation controllers. It runs ok in simulator and on real device as well. What makes me feel uneasy however, is this message I've got on app startup in console.Application windows are expected to have a root view controller at the end of application launch

I've googled it, but I can't find answer to my question. Mandatory appDelegate didFinishLaunchingWithOptions

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 
    [defaults setBool:FALSE forKey:@"loggedIn"];
    [defaults setInteger:0 forKey:@"token"];
    [defaults synchronize];

    _window.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"app_bg.png"]];

 return YES;
}

My main.m code

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

I'll be glad if someone could help me :) Thanks you!

Community
  • 1
  • 1
Yanchi
  • 1,030
  • 1
  • 20
  • 31

1 Answers1

0

Try to set your window's root view controller in didFinishLaunchingWithOptions. If it's a nav controller, put:

UINavigationController *nav = (UINavigationController *)self.window.rootViewController;
JMarsh
  • 934
  • 7
  • 19