1

Xcode 8.0 ベータ 4 で新しい macOS プロジェクトを作成し、肉付けする前にベアボーン アプリを実行してみました。Xcode 8 では、アプリのウィンドウは開きません。しかし、私が Xcode 7.3.1 を使用するときはそうです。他の、より肉付けされたアプリは、Xcode 8 で問題なく表示されます。何が問題なのですか?

MainMenu.xib からウィンドウ オブジェクトを削除しましたが、MainWindowController.swift を作成したときに、MainWindowController.xib に別のウィンドウが自動的に作成されました。これが私のコードです(コメントは削除されています)。これはかなり標準的なようです:

AppDelegate.swift:

import Cocoa

@NSApplicationMain

class AppDelegate: NSObject, NSApplicationDelegate {

var mainWindowController: MainWindowController?

    func applicationDidFinishLaunching(aNotification: NSNotification) {
        let mainWindowController = MainWindowController()
        mainWindowController.showWindow(self)
        self.mainWindowController = mainWindowController
    }
}

MainWindowController.swift:

import Cocoa

class MainWindowController: NSWindowController {

    override var windowNibName: String {
        return "MainWindowController"
    }
    override func windowDidLoad() {
        super.windowDidLoad()
    }
}

それだけです。Xcode 7.3.1 では、空のウィンドウが開きます。Xcode 8.0 beta 4 アプリは起動しますが、ウィンドウは開きません。Xcode 8 (ベータ版) で、表示されるアプリと表示されないアプリとの決定的な違いが何であるかを知っておくと役に立ちます。

4

0 に答える 0