Managing two storyboards in App Delegate

百般思念 提交于 2019-12-01 09:27:24

The problem is in line:

self.window?.rootViewController.storyboard.instantiateInitialViewController()

You should use this instead:

self.window?.rootViewController = storyboard.instantiateInitialViewController()

Edit: I have removed as UIViewController because it is no longer needed.

For anyone using Xcode 7 or above, probably due to Swift 2.0, this line:

self.window?.rootViewController.storyboard.instantiateInitialViewController()

Should actually be:

self.window?.rootViewController = storyboard.instantiateInitialViewController()

Note that as UIViewController is no longer needed.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!