NSLog while debugging the simulator

I dont think NSLog statements are appearing in the debug info window while debugging in the ios simulator. I can see them in console.


I believe that is not only known, the debug console even explicitly tells you. Simulator shows only stdout, no NSog, device shows only NSLog, no stdout, IIRC. Which I know is annoying, but out of my hands. FWIW, if you use Elements RTL’s “Log” function, it should do the right thing for either.

Hm, actually no, it’s supposed to be the reverse, stdout doesn’t work in Simulator, NSLog used to, but I can confirm it also no longer does :(. I will have a look but chances are that this is out of my control (I just capture what “simctl” gives me), and something Apple changed/broke.

~> Please note: The debugger cannot capture StdOut (from `print()` or `writeLn()`) from the Simulator. `NSLog()` will be visible.

To me that reads like NSLog will be visible. I didnt know about Log, that would be handy but it doesnt appear to work


Yes sorry I hit send after you replied

1 Like
Simulator is already booted.
Running /usr/bin/xcrun simctl install E602CCE9-C591-4FF6-AAD3-2702D04F2DB3 "/Users/mh/Test Projects/App2/Bin/Debug/iOS Simulator/App2.app"
Running /usr/bin/xcrun simctl launch -w --stdout=/var/folders/9f/k6_0xsw91hdbgjgkby0zs6xc0000gn/T/4E057334-11AE-4710-8839-55BAC8413DD6/stdout --stderr=/var/folders/9f/k6_0xsw91hdbgjgkby0zs6xc0000gn/T/DE7DA45A-8762-4350-925C-2E867733F807/stderr E602CCE9-C591-4FF6-AAD3-2702D04F2DB3 org.me.App2
reading StdOut from /Users/mh/Library/Developer/CoreSimulator/Devices/E602CCE9-C591-4FF6-AAD3-2702D04F2DB3/data/var/folders/9f/k6_0xsw91hdbgjgkby0zs6xc0000gn/T/4E057334-11AE-4710-8839-55BAC8413DD6/stdout
reading StdErr from /Users/mh/Library/Developer/CoreSimulator/Devices/E602CCE9-C591-4FF6-AAD3-2702D04F2DB3/data/var/folders/9f/k6_0xsw91hdbgjgkby0zs6xc0000gn/T/DE7DA45A-8762-4350-925C-2E867733F807/stderr

all looks proper to me :(.

I see there’s a new --console option for simctl launch though. I’ll see if I can make that one work.

Can’t get --console to work reliably.

i run

/usr/bin/xcrun simctl launch -w --console E602CCE9-C591-4FF6-AAD3-2702D04F2DB3 org.me.App2
org.me.App2: 56814

from terminal and its fine, and console output work (but I still only get NSLog, not the actual stdout). if I tun it from inside Fire I never get the response message with the pid (which I get fine when running it with --stdout). :(.

I’ll keep digging deeper, later.

1 Like