Xcode doesn't write anything to output console

2020-02-05 12:18发布

问题:

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.

回答1:

In the debug area, hit the right half-square.

N.B. area shrunk for image size. Yours should be wider.



回答2:

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.



回答3:

Please make sure, You are selecting All Output



回答4:

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.



回答5:

This happened to me as well and it turned to be the following:

  • installed release build of my app OTA
  • installed over top of release build in XCode/debugger

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.



回答6:

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



回答7:

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.



回答8:

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.



回答9:

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.



回答10:

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.



回答11:

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



回答12:

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.



回答13:

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:



标签: ios xcode