Including constants.h in Prefix.pch interrupts code completion, syntax highlighting

My application has many constants (kvo keys, enumerations, etc.) that are used for almost every class. I have a constants.h file with all of them. I want to include this file in the Prefix.pch file as follows:

#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "AppConstants.h"
#endif

However, when I include the file in this way, Xcode 4 syntax highlighting and code completion stop working. If I manually include the constant file in the header file for each class that uses them and remove the include from the pch file, the syntax highlighting and code completion will return.

Is this the expected behavior? How to include a constant file in each file without using a pch file? Is the problem that the file "AppConstants.h" is included on its own due to the pch file?

+3
source share
1 answer

Look at the question . I had the same problem as you. If the first answer doesn’t fix it for you, then down on the page they mention, the Precompile Prefix Header parameter is set to NO, which fixed this for me.

Hope this helps.

+5
source

All Articles