问题场景:
Xcode 6.0版本之前生成项目的时候会自动生成一个 项目名字-Prefix.pch 这样的文件,但Xcode6.0版本后不给自动生成了,需要我们自己创建并且在Build Settings中设置一下。
Xcode 6 之前版本生成的项目:
Xcode 6 之前版本pch文件内部代码:
//
// Prefix header
//
// The contents of this file are implicitly included at the beginning of every source file.
//
#import <Availability.h>
#ifndef __IPHONE_3_0
#warning "This project uses features only available in iOS SDK 3.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif
1. CMD + N 在项目的 Supporting Files 文件夹下 新建pch文件
2. 修改 Build Settings 内容
3. 修改pch文件内容(可选)
4. CMD + B 测试可用性