我沒有使用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