Database Reference
In-Depth Information
for those coding situations in which I tell myself “This will never happen.”
Now, instead of a comment that causes me to smack my head later, I get an
NSAssertion
immediately.
The third of these commonly used macros is the
ZAssert
.
ZAssert
is designed as
a replacement to the venerable
NSAssert
. When the
DEBUG
compiler flag is set,
this will perform in a similar way as
NSAssert
. It will throw an
NSAssertion
if the
condition fails. However, in production, when assertions have been turned
off, it will still function but will spit out its results to the console only on a
failure. This allows us to actually roll functionality into the
ZAssert
, which we
were not able to do previously because the
NSAssert
would not perform the
conditional check at all if assertions were turned off.