Information Technology Reference
In-Depth Information
5.
If you need to add more tokens, repeat the process.
You can define a value for the token by adding = (equal sign) followed by the value. The critical element
that “tokenizes” your entry is the
-D
preix.
You also can simply
#define
tokens in your project's
-Prefix.pch
file. They're available to every file
in the project, and they override existing definitions.
TIP
The predefined token
NS_BLOCK_ASSERTIONS=1
for the Release configuration is an example a token with a value.
If you want to use
#ifdef
, it's enough to define the token without giving it a value. Use the more general
<tokenname>=<value>
only if you want to check a numeric value or use a string.
TIP
If you add
#define NSLog
to your project's
-Prefix.pch
file, all instances of
NSLog
are stripped from your
code. This is a quick way to eliminate log messages when you no longer need them.
After you've defined MY_TOKEN correctly, you can use this conditional directive to include when the token is
valid:
#ifdef MY_TOKEN