如何添加.pch or prefix.pch 文件到xcode

  • 什么事.pch文件?

File > New > File > iOS > Other > PCH File

Paste_Image.png

*设置pch 文件名为: projectName-Prefix.pch

*设置pch 文件内容

//
// Prefix header
//
// The contents of this file are implicitly
// included at the beginning of every source file
//

#import <Availability.h>

#ifndef __IPHONE_5_0
#warning "This project uses features only available in iOS SDK 5.0 and later."
#endif

#ifdef __OBJC__
   #import <UIKit/UIKit.h>
   #import <Foundation/Foundation.h>
#endif
  • Project > Build Settings > Search for “Prefix Header
Paste_Image.png

6.) 输入:$(SRCROOT)/YourProject-Prefix.pch
7.) Clean 并且 build你的工程

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容