XCode - 创建存档失败,错误 «…-Prefix.pch» 未找到

XCode - creating archive fails with error «…-Prefix.pch» not found

我有一个包含多个目标的工作区。

每个目标都有自己的 prefix.pch 文件。 Prefix-Header 在 Build Settings 中输入并且 Precompile Prefix Header 设置为 YES。

当我在我的设备上 运行 应用程序编译并且 运行 正常。 我刚刚构建应用程序时没有错误。

但是当我尝试将其存档时,出现编译错误:

No such file or directory: '/Users/me/Library/Developer/Xcode/DerivedData/myApp-dcmvkatguqcxgjfyrqcunbsfuxcd/Build/Intermediates.noindex/ArchiveIntermediates/myAppTarget/PrecompiledHeaders/SharedPrecompiledHeaders/13524936819627194222/myAppTarget-Prefix.pch'

事实上,当我在我的硬盘上打开这个文件夹时,我看不到 pch 文件。但是,那里有类似的文件:

myAppTarget-Prefix.pch.d
myAppTarget-Prefix.pch.dia
myAppTarget-Prefix.pch.gch

我尝试了在 SO 和其他地方找到的一切,但没有任何帮助。

我安装了 Cocoapods 并在这个项目中使用了它们,但我认为错误与此无关(它们似乎可以正常编译)。

XCode12.4

看来我明白了。

罪魁祸首是一个完全不相关的构建设置。

Other C Flags 中,我的设置在调试和发布时有所不同。 我在两者中都有 $(inherited),但在发布设置中我还有 -isystem - 显然已经包含在 $(inherited) 中。这导致了以 prefix.pch 未被复制而结束的大量错误...