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:
@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 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
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.