Xcode 4: How do you view the console?

2020-01-29 04:29发布

I can't seem to find a way to have the console run (to show NSLog comments) in XCode 4. The normal method for the previous version of XCode does not work. Does anyone have an idea of how to accomplish this?

8条回答
放我归山
2楼-- · 2020-01-29 04:33

for Xcode 5:

View->Debug Area->Activate Console

shift + cmd + c

查看更多
手持菜刀,她持情操
3楼-- · 2020-01-29 04:33

There's two options:

  1. Log Navigator (command-7 or view|navigators|log) and select your debug session.

  2. "View | Show Debug Area" to view the NSLog output and interact with the debugger.

Here's a pic with both on. You wouldn't normally have both on, but I can only link one image per post! http://i.stack.imgur.com/4gG4P.png

查看更多
淡お忘
4楼-- · 2020-01-29 04:36

Here' an alternative

In Xcode 4 short cut to display and hide console is (command-shift-Y) , this will show the console and debugger below ur text edior in the same window.

查看更多
戒情不戒烟
5楼-- · 2020-01-29 04:46

The console is no extra window anymore but it is under the texteditor area. You can set the preferences to always show this area. Go to "General" "Run Start" and activate "Show Debugger". Under "Run completes" the Debugger is set to hide again. You should deactivate that option. Now the console will remain visible.

EDIT

In the latest GM Release you can show and hide the console via a button in the toolbar. Very easy.

查看更多
混吃等死
6楼-- · 2020-01-29 04:52

Here's an alternative.

  1. In XCode4 double-click your Project (Blueprint Icon).
  2. Select the Target (Gray Icon)
  3. Select the Build Phases (Top Center)
  4. Add Build Phase "Run Script" (Green Plus Button, bottom right)
  5. In the textbox below the Shell textfield replace "Type a script or drag a script file from your workspace" with "open ${TARGET_BUILD_DIR}/${TARGET_NAME}"

This will open a terminal window with your command-line app running in it.

This is not a great solution because XCode 4 still runs and debugs the app independently of what you're doing in the terminal window that pops up.

查看更多
干净又极端
7楼-- · 2020-01-29 04:53

If you just want to have the log output display when you run your app then you can go into XCode4 preferences -> Alerts and click on 'Run starts' on the left hand column.

Then select 'Show Debugger' and when you run the app the NSLog output will be displayed below the editor pane.

This way you don't have to select on the 'up arrow' button at the bottom bar.

查看更多
登录 后发表回答