Xcode7 添加PCH文件
1.) 打开你已经存在的XCODE工程. 在Supporting Files目录下,选择 File > New > File > iOS > Other > PCH File 然后点击下一步.
2.) 给你的PCH文件起名字projectName-Prefix.pch. 例如你的项目工程名为iOSSample然而你的PCH 文件的名字应该为 iOSSample-Prefix.pch然后点击创建按钮.
3.) 选择 PCH 文件(文章的示例文件为 iOSSample-Prefix.pch) 并且替换文件内容,内容如下.
4.) 找到 Project > Build Settings > 搜索 “Prefix Header“
5.) “Apple LLVM 6.0″ 栏目中你将会看到 Prefix Header 关键字.
6.) 输入: YourProjectName/YourProject-Prefix.pch 或 $(SRCROOT)/YourProject-Prefix.pch
7.),将Precompile Prefix Header为YES,预编译后的pch文件会被缓存起来,可以提高编译速度
8.) Clean 并且 build 你的项目.
一些配置,有什么多出需要用到就往里面加
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "UIView+Extension.h"
#import "UIBarButtonItem+Extension.h"
#ifdef DEBUG // 调试状态, 打开LOG功能
#define QSLog(...) NSLog(__VA_ARGS__)
#else // 发布状态, 关闭LOG功能
#define QSLog(...)
#endif
// 随机色
#define QSRandomColor [UIColor colorWithRed:arc4random_uniform(256)/255.0 green:arc4random_uniform(256)/255.0 blue:arc4random_uniform(256)/255.0 alpha:1.0]
// 是否为iOS7
#define iOS7 ([[UIDevice currentDevice].systemVersion doubleValue] >= 7.0)
#endif