'Application windows are expected to have a root view controller at the end of application launch' [
2017-08-29 11:41
459 查看
删除Main.storyboard和launchboard.storyboard之后,将General ——》Deployment Info ——》Main Interface设置为空
在didFinishLaunchingWithOptions中添加以下代码后启动模拟器出现'Application windows are expected to have a root view controller at the end of application launch'异常
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
self.window = UIWindow(frame: UIScreen.mainScreen().bounds);
self.window?.backgroundColor = UIColor.redColor();
self.window?.makeKeyAndVisible();
解决办法是:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
self.window = UIWindow(frame: UIScreen.mainScreen().bounds);
self.window?.backgroundColor = UIColor.redColor();
self.window?.makeKeyAndVisible();
let rootViewController = UIViewController() as UIViewController;
let navigationController = UINavigationController(rootViewController: rootViewController) as UINavigationController;
self.window?.rootViewController = rootViewController;
self.window?.addSubview(navigationController.view);
return true
}
在didFinishLaunchingWithOptions中添加以下代码后启动模拟器出现'Application windows are expected to have a root view controller at the end of application launch'异常
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
self.window = UIWindow(frame: UIScreen.mainScreen().bounds);
self.window?.backgroundColor = UIColor.redColor();
self.window?.makeKeyAndVisible();
解决办法是:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
self.window = UIWindow(frame: UIScreen.mainScreen().bounds);
self.window?.backgroundColor = UIColor.redColor();
self.window?.makeKeyAndVisible();
let rootViewController = UIViewController() as UIViewController;
let navigationController = UINavigationController(rootViewController: rootViewController) as UINavigationController;
self.window?.rootViewController = rootViewController;
self.window?.addSubview(navigationController.view);
return true
}
相关文章推荐
- Application windows are expected to have a root view controller at the end of application launch问题分析
- Application windows are expected to have a root view controller at the end of application launch
- “Application windows are expected to have a root view controller at the end of application launch”
- Application windows are expected to have a root view controller at the end of application launch
- Application windows are expected to have a root view controller at the end of application launch
- Application windows are expected to have a root view controller at the end of application launch
- Application windows are expected to have a root view controller at the end of appliaction launch.
- Application windows are expected to have a root view controller at the end of appliaction launch.
- Application windows are expected to have a root view controller at the end of application launch'
- 关于Application windows are expected to have a root view controller at the end of application launch
- Application windows are expected to have a root view controller at the end of application launch
- 'Application windows are expected to have a root view controller at the end of application launch'
- Application windows are expected to have a root view controller at the end of application launch
- Application windows are expected to have a root view controller at the end of application launch
- Application windows are expected to have a root view controller at the end of application launch 的解决
- Application windows are expected to have a root view controller at the end of application launch解决方法
- 'Application windows are expected to have a root view controller at the end of application launch'
- Applications are expected to have a root view controller at the end of application launch
- 在写引导页面时,出现Application windows are expected to have a root view controller at the end of application
- iOS 9出现错误Applications are expected to have a root view controller at the end of application launch