'Could not find a storyboard named 'MainTabController' in bundle NSBundle

落花浮王杯 提交于 2019-12-06 03:48:21

What is the name of your storyboard? Is it MainTabController.storyboard or Main.storyboard?

You are trying to load a storyboard named "MainTabController":

let mainstoryboard = UIStoryboard(name: "MainTabController", bundle: nil)

But previously you called it Main.storyboard:

Fiddle with the Target Membership Main.storyboard.

Also if the main tab controller is in the same storyboard as your login view controller then you can try to use this:

let mainTabController = self.storyboard.instantiateViewController(withIdentifier: "MainTabController")

Your story board is named as Main.storyboard. MainTabController is the controller in the Main storyboard.

let mainstoryboard = UIStoryboard(name: "Main", bundle: nil)
let mainTabController = mainstoryboard.instantiateViewController(withIdentifier: "MainTabController") as! MainTabController
mainTabController.selectedViewController = mainTabController.viewControllers?[1]
let mainstoryboard = UIStoryboard(name: "MainTabController", bundle: nil)

Your storyboard is named "Main"

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