Xcode shows an error when trying to print an object with po
, but only for one project.
error: Couldn\'t mater
I just run into a similar problem: At one point suddenly the Xcode debugger printed out some object types especially NSStrings as (null) although they were initialized with a value. Printed out via
NSLog(@"String value: %@", myString);
the correct value for the object was shown.
Confusing! Solving the problem was rather easy: I just shut down Xcode and restarted my computer. After I restarted Xcode everything works fine again :).
It seems everyone has their own solution.
For me, I use Objective-C
and Swift
at the same time.
First of all, go to TARGETS -> Build Settings
and search the code generation
You’ll find Apple LLVM 6.0
and Swift Compiler
Change their Optimization Level
all to None
, then Debug, you may find the value not nil
Amazingly once you can see the value, you solve this problem permanently, then you can change the Optimization Level
to it used to be.
That's all it took for me.
For me, Xcode was filtering out the debugger output. Make sure your output setting is Debugger Output or All Output
The solutions here will also fix the bug where you see error: <EXPR>:1:1: error: use of unresolved identifier
every time you try to po
a variable.
For me the solution was to go to Build Settings
and search for Optimization Level
and make sure each Debug
setting was set to None
.
Make sure that Address Sanitizer is turned off in your Scheme settings. The Address Sanitizer does not work well with the debugger.