新建pch文件

新建pch文件--妖妖

(这个工作最好在工程新建的时候进行一般我喜欢在项目新建的时候就将pch文件设置好)

1.(command +n)新建pch文件,或者是new file->other ->Header File

2.打开build setting 将prefix  header 的路径设置为${SRCROOT}/工程名/工程名-Prefix.pch

3. 将Precompile PreFix Header 设置为yes,否则pch文件不会进行文件的预编译

4.在pch文件命名的时候最好是按照命名的规则,如:工程名-Prefix.pch

pch 文件中(按照实际情况改变一下)

#import <Availability.h>

#ifdef __OBJC__

#import <UIKit/UIKit.h>

#import <Foundation/Foundation.h>

#endif

爱code的妖妖
原文地址:https://www.cnblogs.com/yaoyao0110/p/4757561.html