7

I want to test my app when it is not launched via Xcode, but rather by launching directly from the springboard. And I want to see log messages as I do that.

I'm not having any trouble seeing console logs for the simulator using os_log. It's great, because my category and subsystem let me filter to see exactly the messages I want to see in the Console app:

enter image description here

Now I want to do this on my device. I can see my connected device listed in the Console app:

enter image description here

But I don't see any of my app's os_log or print messages in the Console app. Is this just not a supported thing? Is there a way to log to the Console app from my device? Is there any way to log from my app running independently on the device?

EDIT Curiouser and curiouser. Now I'm able to see some of my app's os_log messages in the Console while the app runs independently on the device:

enter image description here

The catch, however, is that word "some". It seems to start working for a while and then it just mysteriously stops again. It's as if the pipeline from the device to the Console is unreliable.

So now the question becomes: is there any way to log reliably from my app running independently on the device?

2 Answers 2

7

This is not a complete answer, but a large part of the trick seems to be this:

In Xcode's Devices and Simulators window, locate the device and show the console display by tapping the tiny button at the lower left.

enter image description here

It appears that this somehow opens the floodgates and allows the stream of log events to pass through to the Console app. It still isn't 100% reliable; eventually the stream can be mysteriously shut off, and I have the impression that events are randomly omitted now and then. But it seems to be a sine qua non for getting the stream to flow at all.

Sign up to request clarification or add additional context in comments.

2 Comments

I am using Xcode 14.0.1 and am not seeing this, has this been removed?
@CyberMew That was five years ago; the Xcode interface has greatly changed since then. Maybe this is replaced by the Open Console button at the top.
6

Make sure you have enabled the Include Info Messages & Include Debug Messages from Console.app > Action menu.

enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.