当前位置: 代码迷 >> 综合 >> Applications are expected to have a root view controller at the end of application解决办法
  详细解决方案

Applications are expected to have a root view controller at the end of application解决办法

热度:42   发布时间:2024-01-05 07:38:36.0

首先检查main函数中

int retVal = UIApplicationMain(argc, argv, nil, NSStringFromClass([XXXXDelegate class]));

这句是否写正确,一般最后一个参数 要写成如上所示

然后

检查delegate中这个方法中是否添加了rootViewController

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

下面一个例子:

[viewController = [ViewController alloc] initWithNibName:@"ViewController" bundle:nil];

self.window.rootViewController = viewController;


  相关解决方案