48

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?

Rob
  • 9,433
  • 12
  • 52
  • 87

7 Answers7

78

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

Rob
  • 9,433
  • 12
  • 52
  • 87
66

This is a bug of Xcode8 + iOS10, we can solve it in this way:

When on simulator, add the Name OS_ACTIVITY_MODE and the Value Variables disable and check it (Product -> Scheme -> Edit Scheme -> Run -> Arguments -> Environment). enter image description here

When on device, only add OS_ACTIVITY_MODE and check it(don't add the Value). You'll see the NSLog in the Xcode8 Console. enter image description here

Vincent
  • 4,076
  • 1
  • 36
  • 37
Igor
  • 11,227
  • 4
  • 49
  • 69
11

In iOS10, a lot of system logging is displayed on the console. This can be disabled by including the OS_ACTIVITY_MODE = disabled in the Run Arguments for your scheme

However for iOS10, NSLog messages will not be displayed anymore. In lower iOS versions the messages will still be displayed. So maybe for most test cases you can use a lower iOS version.

Otherwise you can include a Swift function which prints (print function) your text, this is working okay in iOS10.

Tested on iOS10.0.2 and iOS9.3

Vincent
  • 4,076
  • 1
  • 36
  • 37
9

My issue is that I have Debugger Output selected. Once I changed it to either All output or target output NSLogs appear fine.

In case this confuses you its on the left of the Debug area.

timv
  • 3,296
  • 4
  • 32
  • 41
3

I had the same issue. The trick is to search and remove the below mentioned line from the project.

  #define NSLog(...)

Search the entire project and remove it.

bharathi kumar
  • 190
  • 2
  • 8
1

I just experienced this, so here's another thing to check.

-> Make sure you don't have anything typed in the Filter field below the Log Output. So, in my case I was searching for a term in the logger and forgot to delete the searched terms out of the Filter text field. DOH!

Dave Levy
  • 754
  • 10
  • 16
0

My issue was that I'd accidentally severed the referencing outlet from App Delegate (delegate - file's owner).

Jack James
  • 4,832
  • 5
  • 34
  • 36