Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Simple iPhone App (iOS7) Getting Started What is an IBAction?

XCode Console not writing NSLog Data

I am working on the IBAction. I link the button to the controller and everything looks as explained in the video. I add an NSLog(@"Button pressed"); inside the controller and run the simulator. When I run the simulator nothing shows up in the console log. When I press the button nothing shows up in the console either. I am confused as to why my console seems to be broken.

3 Answers

It wasn't hidden, and it wasn't coded improperly. It was Xcode being flakey. I created a new application and did everything I had done before the code looked exactly the same comparatively. But the new project worked and the old one failed.

Hmm well congrats

Well the issue is that if u want it to log when u press the button it must be in the IBAction method or else it wont do anything. So to fix it simply move the NSLog statement into your IBAction statement and it should work fine.

Hope this helps, Kai.

Matthew Mascioni
Matthew Mascioni
20,444 Points

Sorry to hear that!

Your console likely isn't broken, but it may very well be hidden. This happens to me all too often. Check your console area (near bottom of Xcode) and check to see if it looks like this:

Imgur

If it does, click on the button on the far right corner (that's grey in the screenshot, not the blue one next to it) and it should reveal the console area.

Let me know if this helps! If not, we'll investigate further.