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

  • 什么事.pch文件?

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

如何添加.pch or prefix.pch 文件到xcode_第1张图片
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 

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

#ifdef __OBJC__
   #import 
   #import 
#endif
  • Project > Build Settings > Search for “Prefix Header
如何添加.pch or prefix.pch 文件到xcode_第2张图片
Paste_Image.png

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

你可能感兴趣的:(如何添加.pch or prefix.pch 文件到xcode)