1 Reply
      Latest reply on Mar 26, 2020 2:43 PM by Claude31
      wlionel Level 1 Level 1 (0 points)

        Hello:

         

        I am trying to open a Storyboard View from an @IBAction but the app crashes with no log output. Any help will be appreciated.

        Below is the code. Lines 10 to 18 are highlighted in the code when the crash occurs.

         

        @IBActionfunc launchMainMenu(_ sender: NSMenuItem) {
                 if ((mainWindowController) == nil){
                     var windowController : NSWindowController?
                     let storyboard = NSStoryboard()
               
        
                        func openMyWindow()
                        {
                        
                         if let vc = storyboard.instantiateController(withIdentifier: "4554") as? ViewController
                                {
                                 let myWindow = NSWindow(contentViewController: vc)
                                    myWindow.makeKeyAndOrderFront(self)
                                    let controller = NSWindowController(window: myWindow)
        
                                    controller.showWindow(self)
        
                                }
                        
                            }
                      openMyWindow()
                 }
               
            }