我在app delegate didFinishLaunchWithOptions
中实现了以下代码NotificationsViewController *viewController = [[NotificationsViewController alloc] init];
UINavigationController *nav = [[UINavigationController alloc]
initWithRootViewController:viewController];
_window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
_window.rootViewController = nav;
[_window makeKeyAndVisible];
当它到达最后一行代码时,编译器告诉我:
Application windows are expected to have a root view controller at the end of application launch
我做错了什么?我没有将window.rootviewController设置为nag?
答案 0 :(得分:0)
您不需要创建uiwondow。 删除所有分配和inits _window的代码 现在 试试这个:self.window.rootViewController = nav;