Xib加载包含NSSCrollView时崩溃 [英] Xib loading crashes when it contains NSSCrollView

查看:79
本文介绍了Xib加载包含NSSCrollView时崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到我的应用程序崩溃:

I've noticed that my app crashes if I:

  • 为NSWindow使用自定义Swift类
  • 在窗口上添加NSScrollView
  • 运行一个特定的目标(我在这个项目中还有2个目标,并且两个目标在相同的条件下都可以正常工作)

调用它的代码如下:

guard let alertWindow = alert.window else {//It crashes here
    //other code
    return false
}

类实现为空.这只是NSWindow子类(如果我使用NSWindow,一切都还可以)

Class implementation is empty. It's just NSWindow subclass(if I use NSWindow everything is ok)

class CustomAlertWindow: NSWindow {

}

在空的Objective-C子类中正常工作

It works fine with an empty Objective-C subclass

@interface CustomAlertWindow: NSWindow

@end

@implementation CustomAlertWindow

@end

有人遇到过这种崩溃.看起来它尝试订阅NSScrollView事件.而且为什么会失败.我的目标可能出了问题,或者只是Cocoa/XCode/etc.臭虫...

Have someone faced such kind of crash. Looks like it tries to subscribe to NSScrollView events. And somewhy it fails. Probably something is wrong in my target, or perhaps it's just a Cocoa/XCode/etc. BUG...

目前我无法在一个空项目中复制它,但我会继续尝试.

I'm unable to reproduce it in an empty project at the moment, but I'll keep trying.

当我重载 addObserver 方法时,我发现keyPath是" contentLayoutRect "

When I overloaded addObserver method, I discovered that keyPath is "contentLayoutRect"

override func addObserver(_ observer: NSObject, forKeyPath keyPath: String, options: NSKeyValueObservingOptions = [], context: UnsafeMutableRawPointer?) {
    super.addObserver(observer, forKeyPath: keyPath, options: options, context: context)
}

两者相同:

  • 雨燕3
  • XCode版本8.3.3(8E3004b)
  • macOS:10.12.5(16F73)

  • Swift 3.2
  • Xcode 9.0版(9A235)
  • macOS:10.13(17A365)

P.S. 无论如何,谢谢您的关注.

P.S. Any way, thanks for attention.

推荐答案

所有问题都与 Sparkle.framework .

我刚刚更新了它.我们遇到了 bug 讨论中描述的所有问题.

I've just updated it. We had all problems described in bug discussion.

希望没有人遇到类似的问题=)

Hope nobody face similar problems =)

我们有Sparkle版本1.8.0.我很=愧=(

We had Sparkle version 1.8.0 . I'm ashamed =(

这篇关于Xib加载包含NSSCrollView时崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆