Xcode后面的版本不建议在开发时使用pch文件,但如果仍然需要使用pch文件可以这样配置:

1、用快捷键  [CMD] + N 新建文件,选 iOS下的 other->PCH File 

在Xcode中使用pch文件

2、pch文件命名为 PrefixHeader.pch

在Xcode中使用pch文件

3.创建好后就可以在项目中看到这样

在Xcode中使用pch文件

4、之后在Build Settings 中找到Prefix Header

在Xcode中使用pch文件

5、Prescompile Prefix Header 设为 YES,  在Prefix Header中添加pch文件路径

在Xcode中使用pch文件

注意:路径建议使用                 在Xcode中使用pch文件

 

此时可以正常使用 pch 文件了。

 

相关文章:

  • 2021-10-16
  • 2022-12-23
  • 2021-04-15
  • 2021-10-07
  • 2021-11-30
  • 2022-12-23
  • 2022-01-04
  • 2021-08-03
猜你喜欢
  • 2021-04-29
  • 2021-12-23
  • 2022-01-25
  • 2021-07-09
  • 2022-12-23
  • 2021-09-05
相关资源
相似解决方案