Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSLog not printing to console

Tags:

nslog

I have an Xcode project I've been working on for months. I've never had a problem with NSLog, but after upgrading to Xcode 4.2 nothing will log to the console. I even tried throwing this in viewDidLoad:

    - (void)viewDidLoad {     [super viewDidLoad];      NSLog(@"Can anyone hear me?"); 

And nothing. Is anyone else having this problem or know a solution?

like image 328
serverpunk Avatar asked Oct 22 '11 00:10

serverpunk


People also ask

Where does NSLog write to?

NSLog outputs messages to the Apple System Log facility or to the Console app (usually prefixed with the time and the process id).

How do I check my NSLog?

NSLog() output on the simulator does indeed show up in the Console Mac OS X application. Go to All Messages and then filter based on your app name to get rid of the fluff, and run again. You'll see it in your output if the NSLog code is actually being hit during the execution of your program.

How do you print a Boolean value in Objective C?

There is no format specifier to print boolean type using NSLog. One way to print boolean value is to convert it to a string. Another way to print boolean value is to cast it to integer, achieving a binary output (1=yes, 0=no).

How do I display print in Xcode?

Press ⇧⌘Y or choose View > Debug Area > Show Debug Area to show the console output (or ⇧⌘C / Activate Console). Usually, this window will open automatically when your program produces output (this is controlled by the Behaviors section of Xcode's Preferences).


1 Answers

Well, this is embarrassing. The console got deactivated somehow and I was actually watching the variables window. Pressing Shift + + C did the trick.

Many thanks to Robert King on this thread:

https://devforums.apple.com/message/565880#565880

like image 114
serverpunk Avatar answered Sep 30 '22 00:09

serverpunk