Missing prefix file in Xcode 6

When creating a new project in Xcode 6, the Prefix.pch file is missing in the generated project. Is this intended? Should we continue to create our own, or is there a new method that we should use instead?

I don't use it too much, but having a few key system frameworks like Foundation and UIKit available in every file is helpful, as well as a few third party frameworks in use. Is it the preferred solution to just create your own prefix file manually and tweak it in build settings or something?

+3


source to share


1 answer


You can easily add the Prefix.pch file like this:

1) Add new .pch file to your project -> New file -> Other -> PCH file

2) Go to project build setup.

3) Find the "prefix title". You should find this under Apple LLVM.



4) Paste this into $ (SRCROOT) /yourPrefixHeaderFileName.pch

5) Clean and build the project

If you are using Objective-C in the same way you did before xCode 6, you will also have to import the UIKit and Foundation frameworks into a .pch file. Otherwise, you will have to import these frameworks manually in each header file. You can add the following code anyway, as it checks the language used:

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

      

+7


source







All Articles