-1

So I read similar posts, and I think I have everything I need In my AppDelegate.m the function application:didFinishLaunchingwithoptionis as follows:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
      {

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

// Override point for customization after application launch.

if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {

    self.viewController = [[[ViewController_iPhone alloc] initWithNibName:@"ViewController_iPhone" bundle:nil] autorelease];

} else {

    self.viewController = [[[ViewController_iPad alloc] initWithNibName:@"ViewController_iPad" bundle:nil] autorelease];

}

self.window.rootViewController = self.viewController;

[self.window makeKeyAndVisible];

return YES;

}

My appdelegate.h looks like this :

 @class ViewController;

 @interface AppDelegate : UIResponder <UIApplicationDelegate>

 @property (strong, nonatomic) UIWindow *window;

 @property (strong, nonatomic) ViewController *viewController;

 @end

And finally my main.m looks like this:

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

PLease help, the app just loads a black screen, I don't know where the problem is.

Peter P
  • 289
  • 1
  • 5
  • 17

1 Answers1

0

Make sure you have set the Main nib file base name for iPhone and iPad in the info tab of your target settings.

ale84
  • 1,406
  • 12
  • 16
  • So I went to the info tab in my target, and added the two keys for the names of the main nib files, by that I am assuming you meant ViewController_iPhone.xib (without the .xib) and similar for iPad. But now I have this error: Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key landscapeView.' – Peter P Mar 08 '12 at 01:05
  • Also landscapeView is a UIView defined in ViewController: IBAction UIView *landscapeView; The landscapeView is linked to Landscape, a View in my ViewController_iPhone.xib file. – Peter P Mar 08 '12 at 02:10