问题
I first noticed this with Cmd-/
occasionally refusing to work for comment-uncomment lines of code. But now (having just gone to XCode 4.1, although that may not be related) it's happened with Cmd-B
to build as well.
I can't figure out what I'm doing to cause this, or if there's any pattern to when it happens.
回答1:
Hit command+[
once and then command+/
starts working. You can hit command+]
again to undo the indentation effect.
Originally posted my answer here
回答2:
Seems to have been fixed in 4.2. As an answer, perhaps unsatisfying, but at least it's resolved.
回答3:
In my case my keyboard was working in other files the current opened file was locked. Just reveal in finder your current file where your keyboard was not working, and go to info (Cmd+I) of this file in finder and unlock this file. Your keyboard will start working for this file.
My page was locked using cmd+/.
来源:https://stackoverflow.com/questions/7306656/keyboard-shortcuts-in-xcode-stop-working