应用程序窗口应在应用程序启动结束时具有根视图控制器(Iphone App)

时间:2015-06-25 23:46:53

标签: ios objective-c iphone

我正在尝试为我的课程制作一个Iphone应用程序并且我得到了错误

2015-06-26 00:41:31.721 My Movies[3313:6954045] Application windows are expected to have a root view controller at the end of application launch

我目前正在使用Xcode 6.3.2(6D2105)

这是我的AppDelegate.m完成启动选项部分看起来像

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    self.window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor blackColor];

    // Create Film TableView and add it to Navigation Controller, then add Nav'Controller to Window
    FilmTableTableViewController *vc = [[FilmTableTableViewController alloc] initWithStyle:UITableViewStylePlain];
    navController = [[UINavigationController alloc] initWithRootViewController:vc];
    [[self window] addSubview:[navController view]];

    [self.window makeKeyAndVisible];
    return YES;

1 个答案:

答案 0 :(得分:0)

不要将navcontroller添加为子视图。 用

替换它
// [[self window] addSubview:[navController view]];
[self.window setRootViewController:navController];