How to use Predefined Header

Did you ever wonder what was this single file called [YourProjectName]_Prefix.pch.

prefix_pch.jpg

Sure this look like a perfectly well formed Objective-C header, but did you ever try, for example, to use the #define precompiler directive in this file and then using the predefined keyword in one of your project’s classes. No Luck hey, it seems that this header is never read. Sound bizzare isn’t it.

The answer is simply that, for a reason I can’t understand Apple , just forgot to configure properly the project template. Then we have to do it by ourself. Just go to the Project menu and then select the Edit Active Target ‘[YourProjectName](see below).
menu.jpg

Finally correct the two Prefix build options such that it looks like below.
target_info.jpg

Now you’re done, enjoy the use of the centralized header.

It seems also possible to modify the template in order to have this options directly set. CocoaDev seems to be a good starting point for further investigations on the subject.