Reputation: 621
I am working on an iPhone/iPad app. All of a sudden output console stopped displaying ANY messages AT ALL. I tried to open older project - works just fine. So I thought that local project's repository got corrupted somehow, so I tried to create a new project - no messages at all are getting written to console output. Did I do something with Xcode settings accidentally? I am at a complete loss and frustrated.
Please help if you have any ideas.
Thanks.
Upvotes: 34
Views: 30130
Reputation: 366
Goto Product --> Scheme --> Edit Scheme Select Run option in left menu & select Argument in the header tab menu
Add "IDEPreferLogStreaming" as "YES" under Environment Variable like the below screenshot
Verified in Xcode 15.3
Upvotes: 0
Reputation: 542
It can also be that somebody has put
#define NSLog(...);
into your code. This eliminates almost all output.
Upvotes: 0
Reputation: 31
I had OS_ACTIVITY_MODE checked to disabled. once i removed this the console was showing debug info again.
Upvotes: 1
Reputation: 71
Try to press the trash bin icon.
I know it's silly, but in my case it worked. It might've refreshed the log output console:
Upvotes: 1
Reputation: 5813
Using filter?
A similar thing happened to me. In my case, I had by misstake entered a filter in the status bar of the debug area. Only rows that match the filter are displayed, and since my filter was rubbish nothing was displayed.
Upvotes: 0
Reputation: 13625
I've build a new scheme, and on the Launch option I checked: "Wait for executable to be launched" (as in the picture below)
and apparently that disables the NSLog... according to this:
NSLog not working when "wait for executable to be launched" is set
Upvotes: 6
Reputation: 8069
Xcode 10.1 targeting iOS 11, Xcode stopped displaying console output from one build to another minutes later.
I have OS_ACTIVITY_MODE as an environment variable in my scheme and I get no output in the console in Xcode.
If I disable or remove OS_ACTIVITY_MODE from my scheme my log appears in the console - alas with a lot of system logging as well.
Try disabling OS_ACTIVITY_MODE from Edit scheme > Run, in the section Environment Variables if you have it set there.
Upvotes: 2
Reputation: 1172
Doubtful anyone will have my same issue, but mine was because my iPad was set to Single App Mode using JAMF or MVM Deployment, and it will not log anything to the console. Other devices print to the console, but the app that is in Single App Mode will not.
Upvotes: 1
Reputation: 767
XCode 9, problem still exists. I did discover that when this starts to happen I don't show the debug area (middle button in pic). Then when I re-run the app, the debug area came back up with the console showing correctly.
Upvotes: 1
Reputation: 71
In my case it was due to hitting resource limits. iTerm was unable to fork new processes.
Quitting some apps or increasing resource limits may help.
Upvotes: 1
Reputation: 592
Let's work this out step by step
NSLog posts to stderr stream and not stdout.
So, first check if you stdout also has the issue by using old school printf function (UTF8string). If this also doesn't work, the problem is most likely not with the logging function. If it does work, the problem maybe with stderr stream or the NSLog function
After this try logging to a file, by redirecting the stderr and then stdout also to a file. (freopen/dup2 function) If this logs properly, the problem may be in your Xcode project or console.
Please note that if you are already using some sort of redirection, then logs will not be printed in the console. They will either be printed in the console or the file ONLY
Try doing more similar experiments to localize your problem. Please comment on this answer with your observations to give us a better understanding of the issue
Upvotes: 1
Reputation: 3176
This question appears all over the place and is a valid one pointing to a random bug in most versions of xcode. Obviously the majority of people arriving at these answers are just unable to use xcode and therefore credit the 'show the console' type answers. I have worked on a single major project for 6 years now and this appears every month or so. I reboot devices, restart xcode, stand in the corner singing yankee doodle dandy. Nothing has occurred to me as an obvious and repeatable fix. Eventually I will start work one morning and it will be working again. Nothing I have done will be an obvious fix, no updates will have been installed. Just a heads up to those thinking they are going mad.
Upvotes: 41
Reputation: 21
This happened to me as well and it turned to be the following:
Only once I deleted the app from the iPhone's home screen and reinstalled again by running the app in the debugger did console output start working again.
Upvotes: 1
Reputation: 621
Not exactly sure what was happening, but everything works just fine now (after I started Xcode again today). I did have everything turned on (showing output console with "all" checked).
I appreciate everybody's help.
Upvotes: 1
Reputation: 56049
In the debug area, hit the right half-square.
N.B. area shrunk for image size. Yours should be wider.
Upvotes: 57