线程 1:EXC_BAD_ACCESS代码=1,地址=0x2d006e0080

问题描述

当我显示 NSWindow 一次时,它会显示,但是当我再次打开 NSWindow 时,它会崩溃

我在崩溃时收到此错误

Image here

线程 1:EXC_BAD_ACCESS(代码=1,地址=0x2d006e0080)

在这代码

if mainWindow != nil {
            mainWindow.setFrame(NSRect(x: xxxx,y: yyyy,width: width,height: height),display: true,animate: true)
            // This line of code is where the crash happens,if I comment this,it still crashes
        } else {
            mainWindow = NSWindow(contentRect: NSRect(x: 50,y: 50,width: 100,height: 600),styleMask: [.titled,.resizable,.miniaturizable,.closable],backing: .buffered,defer: true)

        }
        
    mainWindow.titlebarappearsTransparent = true
  // When I comment the 2 line,this one crashes
    mainWindow.contentView = myView
    mainWindow.delegate = self

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)