title: Xcode 4 won't show app's main screen
body: <p>After switching to Xcode 4, I thought I would be able to build and run my application exactly like I could in Xcode 3.</p>
  
  <p>Turns out I can't.</p>
  
  <p>Xcode 4 has a funny way of <i>never showing</i> the app's view controller, which is strange.</p>
  
  <p>I can tell Apple's going to eventually force us to switch, which will result in my app being inoperable.</p>
  
  <p>It gets to <code>application:didFinishLaunchingWithOptions:</code> without any errors, before hanging. Eventually the application crashes on the device - but stays on Default.png forever in the simulator.</p>
  
  <p>I thought I could go and edit the <code>application:didFinishLaunchingWithOptions:</code> method the instantiate an instance of the view controller itself and add it to the window - only to reveal that didn't work either.</p>
  
  <p>After numerous failed attempts at this - creating separate UIWindows for the main view controller - I decided the add it to a navigation controller.</p>
  
  <p>Luck then struck me - but only in the simplest of forms. I looked in the log and see that <code>applicationDidBecomeActive:</code> had been called.</p>
  
  <p>But, as usual, no such luck with any sort of view being displayed.</p>
  
  <p>I then decided to see if I could add a UIView with a blue background color and a few UI elements (buttons, labels, etc...) to the window and see if that would work.</p>
  
  <p>Funnily enough it did.</p>
  
  <p>But why not for the main view controller? Not once in Xcode 4 have I successfully had it run my app (even opening it after it has been built fails). I've tried changing the compiler to the same as in Xcode 3, no luck.</p>
  
  <p>I am honestly really confused as to why the application's view controller won't display.</p>
  
  <p>For anyone who wants to give it an attempt as to why it isn't working that would be gratefully appreciated.</p>
  
  <p>Here's the code for the AppDelegate, if you need the code for the view controller I can paste it here, however it's over 2000 lines.</p>
  
  <p>Anyway, here's the .m file:</p>
  
  <pre><code>#import "DocumentationAppDelegate.h"
  #import "DocumentationViewController.h"
  
  @implementation DocumentationAppDelegate
  
  @synthesize window;
  @synthesize viewController;
  @synthesize navigationController;
  
  - (void)applicationWillEnterForeground:(UIApplication *)application {
      NSLog(@"In method %@, which is in class %@.", NSStringFromSelector(_cmd), NSStringFromClass([self class]));
  }
  
  - (void)applicationDidBecomeActive:(UIApplication *)application {
  NSLog(@"In method %@, which is in class %@.", NSStringFromSelector(_cmd), NSStringFromClass([self class]));
  
  }
  
  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  
      NSLog(@"In method %@, which is in class %@.", NSStringFromSelector(_cmd), NSStringFromClass([self class]));
  
      DocumentationViewController *vc = [[DocumentationViewController alloc] init];
  
      UINavigationController *controller = [[UINavigationController alloc] initWithRootViewController:vc];
      controller.navigationBarHidden = YES;
  
      UIWindow *win = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
  
      [win addSubview:controller.view];
      [win makeKeyAndVisible];
  
      return YES;
  }
  
  - (void)applicationWillTerminate:(UIApplication *)application {
  
  }
  
  
  - (void)dealloc {
      [window release];
      [super dealloc];
  }
  
  @end
  </code></pre>
  
  <p>and the .h</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @class DocumentationViewController;
  
  @interface DocumentationAppDelegate : NSObject &lt;UIApplicationDelegate&gt; {
      UIWindow *window;
      DocumentationViewController *viewController;
      UINavigationController *navigationController;
  }
  
  @property (nonatomic, retain) IBOutlet UINavigationController *navigationController;
  @property (nonatomic, retain) IBOutlet UIWindow *window;
  @property (nonatomic, retain) IBOutlet DocumentationViewController *viewController;
  
  @end
  </code></pre>
  
  <p>If any one could help me here it would be tremendously appreciated.</p>