One: Why Xcode6 does not automatically create Precompile Prefix Header
When we write the project, most of the macro definitions, the header file import are in the Precompile Prefix header file. In Xcode 4, 5 of the template project can see the precompile Prefix Header, but in Xcode 6 was castrated, the reason can refer to the following link:
Http://stackoverflow.com/questions/24158648/why-isnt-projectname-prefix-pch-created-automatically-in-xcode-6
The main reasons for Xcode 6 to remove the Precompile Prefix header are:
(1) Remove the auto-Import System Framework class Library header file, can improve the reuse of the original file, easy to migrate.
(2) An obese prefix header will greatly increase the build time.
II: Benefits of using the Precompile Prefix header
To replace frames that are automatically imported in the prefix header, you can manually import them through @import in each file that needs to import the system framework. If you import in the prefix header, we can get the right to use it for free in every file in the project, without having to manually import it in each of the. h/.m files. The document does have its place of convenience.
Three: Add Precompile Prefix Header to the project
If you must use the Precompile Prefix Header, you can refer to the configuration of Xcode 5 to set it manually.
(1) Create a PCH file: command+n, open the new file window: ios->other->pch
(2) Naming the PCH file
Add a PCH file to the project, naming or following the template for Xcode 5: project name-prefix.pch, such as a-prefx.pch
(3) Modify the project configuration file, add the path of the PCH file you just created to the precompile header option in building setting, and note that the debug and release two columns are added:
Attention:
- Precompile Prefix header is yes, pre-compiled PCH files are cached to improve compilation speed
Modify the PCH file path in the following format: Add the path to the precompile header option in building setting "$ (srcroot)/project name/PCH filename" (For example: $ (srcroot)/Custom numeric keypad/ Custom numeric keypad-prefix.pch)
(4) Adding files to the PCH file
At this point, add the PCH file to Xcode6 to complete!
IOS programming using Precompile Prefix Header