AppDelegate.swift崩溃macOS App

时间:2017-11-26 13:42:45

标签: swift macos crash runtime-error appdelegate

当我尝试启动我的应用时,它只会崩溃。它给出的错误是unrecognized selector sent to instance 0x608000000ac0,错误显示在第4行的AppDelegate.swift文件中。这是完整的AppDelegate.swift文件:

import Cocoa

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate { //This is where I get the error

    @IBOutlet weak var window: NSWindow!

    func applicationDidFinishLaunching(_ aNotification: Notification) {
        // Insert code here to initialize your application
    }

    func applicationWillTerminate(_ aNotification: Notification) {
        // Insert code here to tear down your application
    }

    func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
        return true
    }
}

如何修复此错误?提前致谢, Aaronjam

0 个答案:

没有答案