我没有使用main.storyboard,并且通过代码创建所有内容,但是在我的应用程序代理中出现此代码时出现此错误。我并没有在所有的故事板上使用,但我仍然收到这个错误
Failed to instantiate the default view controller for UIMainStoryboardFile 'Main' - perhaps the designated entry point is not set?
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let rootView = HomeCollectionViewController(collectionViewLayout: UICollectionViewFlowLayout())
if let window = self.window {
window.rootViewController = rootView
}
return true
}
您是否将视图控制器添加到故事板?即使你不想使用故事板,你也应该使用一个虚拟的视图控制器,它指向你的课程 – ridvankucuk
Yup刚刚尝试过,它工作。 @ridvankucuk – joethemow
@ridvankucuk如果做得对,那真的不需要。 – GoodSp33d