在Xcode断点(Mac)中没有键盘响应

时间:2022-09-13 20:43:31

I've just encountered a really bizarre scenario and can't find any info on this elsewhere. When Xcode breaks at my breakpoints, all keyboard entry for the whole system is unresponsive. I can switch to another app but no key strokes are recorded. Xcode itself is unresponsive to keyboard input.

我刚刚遇到了一个非常奇怪的场景,在其他地方找不到任何相关信息。当Xcode在我的断点处中断时,整个系统的所有键盘输入都没有响应。我可以切换到另一个应用程序,但没有记录键击。 Xcode本身对键盘输入没有反应。

Anybody else seen this?

还有人见过吗?

I'm running 10.10.1 and Xcode 6.1.

我正在运行10.10.1和Xcode 6.1。

1 个解决方案

#1


0  

Based on the comments above it would seem that this issue has to do with behind the scenes details of Powerbox. To explain further: my app is sandboxed and calls NSOpenPanel. When breaking (Xcode breakpoint) in the completion block of NSOpenPanel I experience system-wide keyboard input loss.

基于上面的评论,似乎这个问题与Powerbox的幕后细节有关。进一步解释:我的应用程序是沙箱并调用NSOpenPanel。当在NSOpenPanel的完成块中断开(Xcode断点)时,我遇到系统范围的键盘输入丢失。

Keyboard entry behaves normally in breakpoints outside of the call to NSOpenPanel. After working past this area of code I observed that my subsequent operations (queued in the background from the completion bock) often finish before the NSOpenPanel is completely torn down (disappears from the screen). My assumption is that until NSOpenPanel is removed from the screen (and maybe further after), Powerbox won't release control of the keyboard.

键盘输入在NSOpenPanel调用之外的断点中正常运行。经过这段代码后,我观察到我的后续操作(在完成块的后台排队)经常在NSOpenPanel完全拆除之前完成(从屏幕上消失)。我的假设是,直到NSOpenPanel从屏幕上移除(可能还有更长时间),Powerbox不会释放对键盘的控制。

Much of this is assumption since I don't have the actual Powerbox code and can't step into it but it seems to fit.

这很大程度上是假设,因为我没有实际的Powerbox代码,也无法进入它,但似乎很合适。

I worked around my debugging issues by utilizing print statements and stepping through code with the variable inspector open. Mouse input continues to function so you can right-click (if you have a two-button mouse) on the variable and print its description at least.

我通过利用打印语句并在变量检查器打开的情况下逐步执行代码来解决我的调试问题。鼠标输入继续起作用,因此您可以右键单击(如果您有一个双键鼠标)变量并至少打印其描述。

Thanks for the help Ken.

谢谢Ken的帮助。

UPDATE I am now delaying execution of any of my post-NSOpenPanel actions using dispatch_after. On my system a delay of 1 second is doing the trick. I really don't like adding arbitrary delays but this seems to work.

更新我现在使用dispatch_after延迟执行任何后NSOpenPanel操作。在我的系统上,延迟1秒就可以了。我真的不喜欢添加任意延迟,但这似乎有效。

#1


0  

Based on the comments above it would seem that this issue has to do with behind the scenes details of Powerbox. To explain further: my app is sandboxed and calls NSOpenPanel. When breaking (Xcode breakpoint) in the completion block of NSOpenPanel I experience system-wide keyboard input loss.

基于上面的评论,似乎这个问题与Powerbox的幕后细节有关。进一步解释:我的应用程序是沙箱并调用NSOpenPanel。当在NSOpenPanel的完成块中断开(Xcode断点)时,我遇到系统范围的键盘输入丢失。

Keyboard entry behaves normally in breakpoints outside of the call to NSOpenPanel. After working past this area of code I observed that my subsequent operations (queued in the background from the completion bock) often finish before the NSOpenPanel is completely torn down (disappears from the screen). My assumption is that until NSOpenPanel is removed from the screen (and maybe further after), Powerbox won't release control of the keyboard.

键盘输入在NSOpenPanel调用之外的断点中正常运行。经过这段代码后,我观察到我的后续操作(在完成块的后台排队)经常在NSOpenPanel完全拆除之前完成(从屏幕上消失)。我的假设是,直到NSOpenPanel从屏幕上移除(可能还有更长时间),Powerbox不会释放对键盘的控制。

Much of this is assumption since I don't have the actual Powerbox code and can't step into it but it seems to fit.

这很大程度上是假设,因为我没有实际的Powerbox代码,也无法进入它,但似乎很合适。

I worked around my debugging issues by utilizing print statements and stepping through code with the variable inspector open. Mouse input continues to function so you can right-click (if you have a two-button mouse) on the variable and print its description at least.

我通过利用打印语句并在变量检查器打开的情况下逐步执行代码来解决我的调试问题。鼠标输入继续起作用,因此您可以右键单击(如果您有一个双键鼠标)变量并至少打印其描述。

Thanks for the help Ken.

谢谢Ken的帮助。

UPDATE I am now delaying execution of any of my post-NSOpenPanel actions using dispatch_after. On my system a delay of 1 second is doing the trick. I really don't like adding arbitrary delays but this seems to work.

更新我现在使用dispatch_after延迟执行任何后NSOpenPanel操作。在我的系统上,延迟1秒就可以了。我真的不喜欢添加任意延迟,但这似乎有效。