Window will not open on application Run

Hello, I am working with the Fifth edition of the book and Xcode 8 Version 8.0 (8A218a)

When I run the app as described on page 17, the pp builds and runs, but no window opens.

I created a Cocoa App using a single window, not a document based application…is there anything else I should check?

I have triple checked for errors in my code, and can find no typos, and as I say it builds and runs fine with no errors…can anyone think of where I should look next? If you are comfortable downloading and looking at my project, it is here:

BTW, the Solutions code runs as expected…

TIA for any and all suggestions!

Are you sure your app is not hiding behind another window? Do you see your app in the dock?

If you post your code, others can have a look and might be able to diagnose the problem you are experiencing.

Howdy Ibex, and thanks for the reply!

Here is the code from the AppDelegate:

import Cocoa

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {

var mainWindowController: MainWindowController?

func applicationDidFinishLaunching() {
    let mainWindowController = MainWindowController(windowNibName:"MainWindowController")
    mainWindowController.showWindow(self)
    self.mainWindowController = mainWindowController
}

func applicationWillTerminate() {
    // Insert code here to tear down your application
}

}

I have diffed my source with source from the Solutions download, and I find no differences…?

I run the built app from the desktop with no other windows open, and there is no window there.

::sigh::

I am wondering/afraid that there might be some way that Sierra has rejiggered things…

I got an answer from StackOverflow:

applicationDidFinishLaunching’s parameter ‘aNotification: NSNotification’ is missing.

I discovered another interesting way to produce code for this exercise which compiles and runs without error, but which doesn’t front the application main window (MainWindowController.xib). In Xcode 8.1 / Swift 3 / macOS Sierra, the method signature for

func applicationDidFinishLaunching(_ notification: Notification) {
...
}

differers from the early Swift example from the book. If an eager young student notices, and then removes the underscore, the application will build and run but won’t front the window.

A discussion of The Underscore in Swift