LaunchScreen.storyboard无法打开Main.storyboard导航控制器

Sid*_*rth 4 xcode ios swift swift3

我刚刚开始使用Swift(newbie)开发新的应用程序。我有

  1. LaunchScreen.storyboard仅带有我的初始屏幕图像
  2. 我有一个Main.storyboard,其中Navigation Controller两个连接了seguesHome和Registration。
  3. 在中ViewController.swiftviewDidLoad我正在决定要调用哪个序列
  4. Main.Storyboard没有rootViewController,我需要决定viewController运行时显示哪个。

    if (Settings.hasRegistrationCompleted()) {
        performSegue(withIdentifier: "Home", sender: nil)
    } else {
        performSegue(withIdentifier: "Registration", sender: nil)
    } 
    
    Run Code Online (Sandbox Code Playgroud)

我的问题

  1. 我在第一行上设置了一个断点if (Settings.has,但断点从未到达此处
  2. LaunchScreen仅持续2秒(在我的模拟器上测试)如何增加它

编辑

我已将其Main设置为Main Interface我的项目。我进行了Clean构建,然后再试一次,没有用。

下面也是Main.Storyboard

在此处输入图片说明

Anb*_*hik 6

在这里您需要确定两件事

第一

检查你的故事板的名称Main.storyboard是否正确连接在你的Target -> general -> Deployment Info -> main Interface,对于如这样

在此处输入图片说明

第二

检查你的INTIAL VC与导航控制器连接,并确保您的初始VC为根控制器

在此处输入图片说明

更新答案

初始设定Stroryboard ID和每个VC

在此处输入图片说明

有改变的appdelegate根控制器后

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    self.window = UIWindow(frame: UIScreen.main.bounds)
    // Override point for customization after application launch.
     let storyboard = UIStoryboard(name: "Main", bundle: nil)
    let rootViewController: UIViewController?
     if (Settings.hasRegistrationCompleted()) {
     rootViewController = storyboard.instantiateViewController(withIdentifier: "HomeVC")
    }else
     {
         rootViewController = storyboard.instantiateViewController(withIdentifier: "RegistrationVC")
    }
     let navigation = UINavigationController(rootViewController: rootViewController!)
    self.window?.rootViewController = navigation
    self.window?.makeKeyAndVisible()
    return true
}
Run Code Online (Sandbox Code Playgroud)