【问题标题】:AppDelegate.swift crashes macOS AppAppDelegate.swift 崩溃 macOS 应用程序
【发布时间】:2017-11-26 13:42:44
【问题描述】:

当我尝试启动我的应用程序时,它只是崩溃了。它给出的错误是unrecognized selector sent to instance 0x608000000ac0,错误显示在我的 AppDelegate.swift 文件的第 4 行。这是完整的 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
    }
}

如何解决此错误?提前致谢, 亚伦詹姆

【问题讨论】:

    标签: swift macos crash runtime-error appdelegate


    【解决方案1】:

    在尝试解决问题一个多小时后,我删除了我的目标(当然是在备份我的代码之后)并创建了一个新目标。感谢您的帮助,@OverD!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-03-06
      • 1970-01-01
      • 2022-06-10
      • 2011-03-31
      • 1970-01-01
      • 1970-01-01
      • 2019-07-31
      相关资源
      最近更新 更多