Application of PCH files in iOS

Source: Internet
Author: User

Today I write a project to use global variables, the first reaction to think of the PCH file this thing.

PCH file is a standard precompiled header file (precompiled header). After Xcode6, if we are going to use a PCH file, we have to manually create it ourselves.

I'm going to record the process of creating a PCH file myself, and I need to see it!

First we have to manually create the PCH file.

1. Create a new file in the project's supporting files or other project locations


2. Select PCH File creation


3. Modify the file name (modify it at your own discretion)


4. Write what you need to set global variables in the PCH file


5. Configure the path


$ (srcroot) Auto Get path

Chat about your project name

prefixheader.pch the PCT file name you created

When the precompile Prefix header is yes, the PCH will be precompiled and the precompiled PCH file will be cached to improve the compilation speed. When the precompile Prefix header is no, the PCH is not precompiled, but is compiled once in each. m file that uses the Framework class library that it imports.

Note: In the PCH file, try not to introduce the header file, although this is very convenient, but the compilation speed will become very slow. The introduction of header files can be specifically built with a. h file for the header.

In the next time I will not regularly update some of the good way to their own book, Thank you, and communicate with each other!



Text/light Drunk 17 (Jane book author)
Original link: http://www.jianshu.com/p/82dcb438f8aa
Copyright belongs to the author, please contact the author to obtain authorization, and Mark "book author".

Application of PCH files in iOS

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.