我收到了一个我需要编译的客户端项目,但是当我运行它时会出现错误Application windows are expected to have a root view controller at the end of application launch
和EXC_BAD_Access (code=2, address=0x0)
据我所知,这是由application:didFinishLaunchWithOptions:
中的AppDelegate
引起的,但我项目的问题是没有AppDelegate
文件。
修改
我尝试在Xcode 4.5.1上运行该项目,现在它正在提供错误address doesn't contain a section that points to a section in a object file.
答案 0 :(得分:0)
问题是没有AppDelegate文件。这通常是设置根视图控制器的地方
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
// set root view controller
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
答案 1 :(得分:0)
我还遇到过“应用程序窗口应该有根视图控制器”错误消息。
如果您使用的是故事板并且已经验证:
验证您是否在视图控制器实现中创建了“视图”UIView @property和@synthezised它。我经历了这个过程,经历了一个漫长的消除过程,当我意识到我已经创建了一个“视图”UIView属性,其名称与IB创建的链接到视图控制器完全相同。
希望这有帮助。