我得到应用程序在应用程序启动错误结束时应该有一个根视图控制器 [英] I am getting the Applications are expected to have a root view controller at the end of application launch error

查看:84
本文介绍了我得到应用程序在应用程序启动错误结束时应该有一个根视图控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我读了类似的帖子,我想我有我需要的一切
在我的AppDelegate.m函数应用程序:didFinishLaunchingwithoptionis如下:

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;

}

我的appdelegate.h看起来像这样:

My appdelegate.h looks like this :

 @class ViewController;

 @interface AppDelegate : UIResponder <UIApplicationDelegate>

 @property (strong, nonatomic) UIWindow *window;

 @property (strong, nonatomic) ViewController *viewController;

 @end

最后我的main.m看起来像这样: / p>

And finally my main.m looks like this:

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

PLease帮助,该应用只是加载黑屏,我不知道问题出在哪里。

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

推荐答案

确保为iPhone和iPad设置了主nib文件基本名称在目标设置的信息选项卡中。

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

这篇关于我得到应用程序在应用程序启动错误结束时应该有一个根视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆