微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决线程 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 举报,一经查实,本站将立刻删除。