Search code examples
cocoa-touchios5uinavigationcontrollermodalviewcontrollerpresentmodalviewcontroller

Present a modal view from didFinishLaunchingWithOptions


I'm trying to migrate the data from a previous version to the actual data format. While the application does this, I want to present a view which displays a waiting message (or a progress, haven't decided yet...).

Currently I'm figuring out when to migrate in the method AppDelegate didFinishLaunchingWithOptions and then I want to present that view modal. But it doesn't work at all.

I tried

[navigationController pushViewController:viewController animated:YES]; // works in a way, but it's not modal and it navigates sideways
[navigationController presentModalViewController:viewController animated:YES]; // does nothing. 

I also searched this forum and found some answers regarding a TabViewController. I tried to apply that to my scenario and even tried:

[window addSubview:viewController.view];
[window makeKeyAndVisible];

Which does exactly nothing. Any ideas?

Thanks,

Mark


Solution

  • Did you instantiate the window?

    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];