0
我想从我的AppDelegate打开一个故事板,但它引发了我的异常:NSInternalInconsistencyException投掷通过AppDelegate中
2016-10-25 10:26:16.776 momnt[22865:1300106] *** Terminating app due to
uncaught exception 'NSInternalInconsistencyException',
reason: 'Application windows are expected to have a root view
controller at the end of application launch'
这里是我想要做的事:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UIStoryboard *loginStoryboard = [UIStoryboard storyboardWithName:@"Login" bundle:nil];
UIViewController *mainViewController = [loginStoryboard instantiateInitialViewController];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = mainViewController;
[self.window makeKeyAndVisible];
return YES;
}
我已经读过新版本的XCode要求所有的Windows必须有一个rootViewController,但我已经这样做了。
这意味着你的应用没有任何root vc启动。 – vaibhav
什么是您的项目故事板名称? –
@RonakChaniyara文件名是Login.storyboard。如果我使用另一个名字,我得到了一个没有找到故事板的错误。 – placplacboom