在 OS X 10.7.2 下解锁错误视图 ((null)) 的焦点

发布于 2024-12-11 13:04:31 字数 2084 浏览 5 评论 0原文

我有一个 Cocoa 应用程序,它有一个 NSWindowController 控制一个 NSWindow ,其中有一个 NSComboBox 。没什么特别的,在升级到 OS X 10.7.2 之前它工作得很好。现在,我收到以下异常,该异常仅在窗口控制器的窗口加载时发生一次。 (由于我的应用程序中的窗口控制器保持加载状态,因此每次应用程序启动时只会发生一次。)随后聚焦和取消聚焦组合框不会触发它。

有人知道 10.7.2 中是否发生了变化,如果是,如何解决?

(Xcode 4.2 会发生这种情况。)

2011-10-24 11:30:21.649 MyApp[7934:707] Unlocking Focus on wrong view ((null)), expected <NSComboBox: 0x40083d6e0>
2011-10-24 11:30:21.653 MyApp[7934:707] (
    0   CoreFoundation    0x00007fff8412d286 __exceptionPreprocess + 198
    1   libobjc.A.dylib   0x00007fff88cdad5e objc_exception_throw + 43
    2   CoreFoundation    0x00007fff8412d0ba +[NSException raise:format:arguments:] + 106
    3   CoreFoundation    0x00007fff8412d044 +[NSException raise:format:] + 116
    4   AppKit            0x00007fff8c76c1d5 -[NSFocusStack unfocusView:] + 194
    5   AppKit            0x00007fff8c7e838e +[_NSAutomaticFocusRing showForView:] + 2545
    6   AppKit            0x00007fff8cdbb4d1 __postActiveFirstResponderChanged_block_invoke_1 + 32
    7   CoreFoundation    0x00007fff840ecf37 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
    8   CoreFoundation    0x00007fff840ece96 __CFRunLoopDoObservers + 374
    9   CoreFoundation    0x00007fff840c2159 __CFRunLoopRun + 825
    10  CoreFoundation    0x00007fff840c1ae6 CFRunLoopRunSpecific + 230
    11  HIToolbox         0x00007fff8c0d73d3 RunCurrentEventLoopInMode + 277
    12  HIToolbox         0x00007fff8c0de58f ReceiveNextEventCommon + 181
    13  HIToolbox         0x00007fff8c0de4ca BlockUntilNextEventMatchingListInMode + 62
    14  AppKit            0x00007fff8c71e3f1 _DPSNextEvent + 659
    15  AppKit            0x00007fff8c71dcf5 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 135
    16  AppKit            0x00007fff8c71a62d -[NSApplication run] + 470
    17  AppKit            0x00007fff8c99980c NSApplicationMain + 867
    18  MyApp             0x0000000100001682 main + 34
    19  MyApp             0x0000000100001654 start + 52
)

I have a Cocoa app that has an NSWindowController controlling an NSWindow with an NSComboBox in it. Nothing special, and it worked fine until upgrading to OS X 10.7.2. Now I get the following exception, which occurs only once, when the window controller's window loads. (Since the window controller in my app remains loaded, it happens only once per app launch.) Subsequently focusing and unfocusing the combo box does not trigger it.

Anyone know whether something changed in 10.7.2, and if so how to work around it?

(This is happening with Xcode 4.2.)

2011-10-24 11:30:21.649 MyApp[7934:707] Unlocking Focus on wrong view ((null)), expected <NSComboBox: 0x40083d6e0>
2011-10-24 11:30:21.653 MyApp[7934:707] (
    0   CoreFoundation    0x00007fff8412d286 __exceptionPreprocess + 198
    1   libobjc.A.dylib   0x00007fff88cdad5e objc_exception_throw + 43
    2   CoreFoundation    0x00007fff8412d0ba +[NSException raise:format:arguments:] + 106
    3   CoreFoundation    0x00007fff8412d044 +[NSException raise:format:] + 116
    4   AppKit            0x00007fff8c76c1d5 -[NSFocusStack unfocusView:] + 194
    5   AppKit            0x00007fff8c7e838e +[_NSAutomaticFocusRing showForView:] + 2545
    6   AppKit            0x00007fff8cdbb4d1 __postActiveFirstResponderChanged_block_invoke_1 + 32
    7   CoreFoundation    0x00007fff840ecf37 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
    8   CoreFoundation    0x00007fff840ece96 __CFRunLoopDoObservers + 374
    9   CoreFoundation    0x00007fff840c2159 __CFRunLoopRun + 825
    10  CoreFoundation    0x00007fff840c1ae6 CFRunLoopRunSpecific + 230
    11  HIToolbox         0x00007fff8c0d73d3 RunCurrentEventLoopInMode + 277
    12  HIToolbox         0x00007fff8c0de58f ReceiveNextEventCommon + 181
    13  HIToolbox         0x00007fff8c0de4ca BlockUntilNextEventMatchingListInMode + 62
    14  AppKit            0x00007fff8c71e3f1 _DPSNextEvent + 659
    15  AppKit            0x00007fff8c71dcf5 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 135
    16  AppKit            0x00007fff8c71a62d -[NSApplication run] + 470
    17  AppKit            0x00007fff8c99980c NSApplicationMain + 867
    18  MyApp             0x0000000100001682 main + 34
    19  MyApp             0x0000000100001654 start + 52
)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

久夏青 2024-12-18 13:04:31

http://hints.macworld.com/index.php?topic=system107& ;page=5

这似乎是 OS X 10.7.* (Lion) 系列中的一个错误。通过对代码进行零更改,在符合 Xcode 4.4.1 的 OS X 10.8 (Mountain Lion) 上不再发生崩溃。

http://hints.macworld.com/index.php?topic=system107&page=5

This appears to have been a bug in OS X 10.7.* (Lion) series. With zero changes to my code, the crash no-longer occurs on OS X 10.8 (Mountain Lion) complied with Xcode 4.4.1.

月亮坠入山谷 2024-12-18 13:04:31

您可以尝试在 NSComboBox 上调用此命令: setFocusRingType:NSFocusRingTypeNone
这应该可以解决问题,尽管它没有解释两个版本之间的差异。

You could try calling this command on the NSComboBox: setFocusRingType:NSFocusRingTypeNone
That should cure the problem, although it does not explain the difference between the two releases.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文