建立Empty Application,新建Storyboard并添加View Controller 控件后运行为空白,并报错

建立Empty Application,新建Storyboard并添加View Controller 控件后运行为空白,并报错

控制台显示:

2012-07-18 15:21:57.338 apress-8[664:f803] Application windows are expected to have a root view controller at the end of application launch

通过和Single View Application模版对比发现:需要至少修改两个地方:

1、AppDelegate.m

 1 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
 2 {
 3 /*
 4     self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
 5     // Override point for customization after application launch.
 6     self.window.backgroundColor = [UIColor whiteColor];
 7     [self.window makeKeyAndVisible];
 8 */
 9     return YES;
10 }

2、项目配置,添加Main Storyboard


/**************************************************************************
                  原文来自博客园——Submarinex的博客: www.cnblogs.com/submarinex/               
  *************************************************************************/

原文地址:https://www.cnblogs.com/submarinex/p/2597501.html