无法使用 XCode/Obj-C 编译 Cocoapods – “Pods-prefix.pch.dia: No such file or directory”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13369946/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 02:05:07  来源:igfitidea点击:

Cannot compile Cocoapods with XCode/Obj-C – "Pods-prefix.pch.dia: No such file or directory"

iosobjective-cxcodegcccocoapods

提问by Fahim

I am using XCode 4.5.1 and iOS 6.0 base SDK.

我正在使用 XCode 4.5.1 和 iOS 6.0 基础 SDK。

Here is the error I am receiving:

这是我收到的错误:

i686-apple-darwin11-llvm-gcc-4.2: /Users/fahim/Library/Developer/Xcode/DerivedData/Currenthiphop-emodxxwwaiojlcboaxuodksuwuww/Build/Intermediates/PrecompiledHeaders/Pods-prefix-evibdktwbatdnbabmrlnderfsxxi/Pods-prefix.pch.dia: No such file or directory

i686-apple-darwin11-llvm-gcc-4.2: /Users/fahim/Library/Developer/Xcode/DerivedData/Currenthiphop-emodxxwwaiojlcboaxuodksuwuww/Build/Intermediates/PrecompiledHeaders/Pods-prefix-evibdktwbatdnbabmrlnderfsxxi/Pods-prefix.pch.dia: No such file or directory

There is only 1 file in the Pods-prefix-xxx directory: Pods-prefix.pch.pth.hash-criteria

Pods-prefix-xxx 目录下只有 1 个文件: Pods-prefix.pch.pth.hash-criteria

Here is my Podfile: platform :ios

这是我的 Podfile:平台:ios

pod 'LibComponentLogging-Core'
pod 'LibComponentLogging-LogFile'
pod 'LibComponentLogging-qlog' 
pod 'LibComponentLogging-pods'

pod 'Facebook-iOS-SDK'
pod 'RestKit'

Any help is appreciated. Thank you!

任何帮助表示赞赏。谢谢!

回答by Ben Kreeger

I actually found this solution right herethat details opening up Xcode using normal means (Finder or the Dock), as opposed to using the open <Workspace>.xcworkspacecommand. I've always used Xcode from my dock, whereas the other developer (who couldn't build the project and was getting the error you were) was using the opencommand from the command line. Once he opened Xcode from the Dock, and manually browsed to open the project that way, he could build it successfully.

我实际上在这里找到了这个解决方案,它详细说明了使用正常方式(Finder 或 Dock)打开 Xcode,而不是使用open <Workspace>.xcworkspace命令。我一直在我的 Dock 中使用 Xcode,而其他开发人员(无法构建项目并收到您的错误)正在使用open命令行中的命令。一旦他从 Dock 打开 Xcode,并手动浏览以这种方式打开项目,他就可以成功构建它。

回答by siuying

If you are using CocoaPods 0.18.0, this might be cause by CocoaPods and is fixed in https://github.com/CocoaPods/CocoaPods/issues/956

如果您使用的是 CocoaPods 0.18.0,这可能是由 CocoaPods 引起的,并已在https://github.com/CocoaPods/CocoaPods/issues/956 中修复

Extra quote in "$(inherited)" was the cause (https://github.com/CocoaPods/CocoaPods/blob/master/lib/cocoapods/generator/xcconfig.rb#L150). It should not be quoted. If you remove them from the xcconfig the project will build again. You may want to check your xcconfig and see if there are extra quote.

“$(inherited)”中的额外引用是原因(https://github.com/CocoaPods/CocoaPods/blob/master/lib/cocoapods/generator/xcconfig.rb#L150)。它不应该被引用。如果您从 xcconfig 中删除它们,项目将再次构建。您可能需要检查您的 xcconfig 并查看是否有额外的报价。

回答by james_womack

This issue can be caused by a few different factors but in my case and the case of some colleagues, this resolved the missing pch.dia

这个问题可能是由几个不同的因素引起的,但在我和一些同事的情况下,这解决了丢失的 pch.dia

Uninstall CocoaPods and install 0.17.1

卸载 CocoaPods 并安装 0.17.1

sudo gem uninstall cocoapods
sudo gem install cocoapods -v 0.17.1 --verbose

Lock your Kiwi version to 2.05 if Kiwi is one of your pods:

如果 Kiwi 是您的 pod 之一,请将您的 Kiwi 版本锁定为 2.05:

target :KiwiUnitTest, :exclusive => true do
  pod 'Kiwi', '2.0.5'

Clean your Xcode project including Derived Data. Close down Xcode, re-open the project and build.

清理您的 Xcode 项目,包括派生数据。关闭 Xcode,重新打开项目并构建。