IOS programming using Precompile Prefix Header

Source: Internet
Author: User

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:

    1. Precompile Prefix header is yes, pre-compiled PCH files are cached to improve compilation speed
    2. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.