Featured iPhone Development Resources iOS Development Tutorials Objective-C

Tutorial: Using Compiler Directives To Create Useful Custom Warning And Error Messages

Some time ago I mentioned a handy guide (way back in the iOS 4 days!) for using macros to accomodate users on different iOS versions.

Here’s a nice guide from Erica Sadun that provides a number of useful compiler directives customize the warnings and errors from Xcode’s clang compiler.

Among the tips you’ll find:

How to use a supplied build script allowing you to convert comments to warnings (great for todo/fixme)
Using a compatibility alias to create Mac or iOS specific code
Creating custom compiler warnings
Creating custom compiler errors
Disabling specific warnings

You can find guide over on the Informit site.

A nice guide to some little known but useful compiler directive tricks.