Search code examples
iphoneiosxcodeipad

How to print value of a constant/macro while debugging in Xcode?


While debugging an iOS application, I know how to print values of objects using :

print "variable name"

po "variable name"

p "integer Variables"

I wanted to know how to print value of a constant while debugging in Xcode? Is there any command that prints value of a constant? Because, if I use the above commands, the Xcode returns an error saying

error: use of undeclared identifier

Thanks.


Solution

  • Macros (what you get when you #define something) are the domain of the language preprocessor. They are expanded and the expanded value is used when compiling your code.

    The debugger doesn't parse your source file, it works off of what's in the binary. So no, you won't be able to view the value of #define macros in the debugger.