No stacktrace when running xcodebuild

I have a strange issue in which a unit test fails only when running tests through the CLI:

xcodebuild test -project project.xcodeproj -scheme project -destination 'platform=iOS Simulator,name=iPhone 8,OS=15.5'

And it fails with:

Fatal error: Attempted to read an unowned reference but object 0x6000036fe610 was already deallocated

Sadly I am using a lot of unowned in my code and the test passes when I run it in the GUI (Xcode).

I am wondering if it is possible to get a stacktrace along with the error, because I do not know where to start now. It just says 'Fatal error' without any helpful line number. I won't just change unowned to weak to make the test pass.

How can I make sure the xcodebuild also provides a stacktrace when an error occurs?

That sort of error should generate a crash report. For info on that topic, see Diagnosing Issues Using Crash Reports and Device Logs.

Share and Enjoy

Quinn “The Eskimo!” @ DTS @ Apple