views:

1222

answers:

5

Hello,

I'm a very new Cocoa user and running into all sorts of problems...

I'm trying to get the content of an Array and found this code to do this.

NSLog(@"array : %@",collection);

The problem is, I'm not getting any console or tracer window that shows this 'echo'

Is there another command I should use, i've tried opening all windows but I don't see the message that should show. I Know the function that this call is in is executed, so the reference is right.

thanks. and sorry for these beginner questions... Using stackoverflow is way faster than reading through all the documentation apple has regarding the subject.

+2  A: 

When XCode runs your project, the editor changes to show a little black button with the letters "GDB" in it. Click on that to see the Debugger which has the console in it.

Good luck!

Oh, and I would read Apple's documentation. It's not that bad.

Genericrich
+5  A: 

From the 'Run' menu, choose 'Console' - keyboard shortcut is Shift-Cmd-R.

richBossa
+2  A: 

In the XCode menu hit Run - Console. This is where NSLog / print / printf etc statements output.

The key command is Command + Shift + R.

The cocoa toString() method is called description as well.

NSLog(@"array : %@",collection);

Will execute

NSLog(@"array : %@",[collection description]);

Which will then call description on each of the collections elements.

Ryan Townshend
+2  A: 

If you want to see it every time you run your application select the "Debugging" tab from the preferences window and change the box that says "On Start" to "Show Console". Additionally i like to check the "Auto Clear Debug Console" checkbox which will clear out the text of the output on starting your application.

Lounges
A: 

4 people answer this question, yet nobody gives him a vote up?

Come on people it's obviously a good question. Lets start giving some votes.

+1 Vote from me

Brock Woolf