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:
Now I want to do this on my device. I can see my connected device listed in the Console app:
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:
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?
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With