编辑 Xcode xcconfig 文件和 Cocoapods
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24236596/
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
Edit Xcode xcconfig file and Cocoapods
提问by onmyway133
I want to edit the xcconfigfile, but unfortunately Xcode only allows 1 xcconfigfile per configuration, and that is Pods.xcconfigbecause I'm using Cocoapods
我想编辑xcconfig文件,但不幸的是 Xcode每个配置只允许 1 个xcconfig文件,那就是Pods.xcconfig因为我正在使用Cocoapods
So how can I edit the xcconfigwithout hurting Cocoapods
所以,我怎么可以编辑xcconfig没有伤害的CocoaPods
I can think of several ways
我能想到几种方法
- Make Xcode use multiple xcconfig files
- Use my own xcconfig file that includes Pods.xcconfig file
- 让 Xcode 使用多个 xcconfig 文件
- 使用我自己的包含 Pods.xcconfig 文件的 xcconfig 文件
So how to deal with this ?
那么如何处理呢?
采纳答案by skywinder
Here is a issue in CocoaPods Tracker. A workaround is described here: #1736.
这是CocoaPods Tracker 中的一个问题。此处描述了一种解决方法:#1736。
As kylef(owner of CocoaPods repo) mentioned:
正如kylef(CocoaPods repo 的所有者)所提到的:
Manual Workaround: Use
pod install --no-integrate
then add#include "Pods/Pods-GCE.xcconfig"
from your custom xcconfig files.I don't think there is a clear solution to automatically fix it, but maybe it would be nice if cocoa pods detected this and told the user. Took me a while to figure out what happened after I did
pod install
and the projects xcconfig files wasn't being included.
手动解决方法:使用
pod install --no-integrate
然后#include "Pods/Pods-GCE.xcconfig"
从您的自定义 xcconfig 文件添加。我不认为有一个明确的解决方案来自动修复它,但如果可可豆检测到这一点并告诉用户,那也许会很好。我花了一段时间才弄清楚在我做了之后发生了什么
pod install
并且项目 xcconfig 文件没有被包含在内。
回答by Raphael
Nowadays (XCode 9.x, CocoaPods 1.4.0) you just add
现在(XCode 9.x,CocoaPods 1.4.0)你只需添加
#include "Pods/Target Support Files/Pods-MyApp/Pods-Pods-MyApp.debug.xcconfig"
to your custom xcconfig. pod install
will complain but automatically do the right thing (nothing); it'll even tell us to do exactly the above.
到您的自定义 xcconfig。pod install
会抱怨但会自动做正确的事情(什么都不做);它甚至会告诉我们完全按照上述操作。
It's not necessary anymore to prevent integration (which would leave us without a workspace, too). FWIW, option --no-integrate
no longer exists; if we wanted it, we'd add :integrate_targets => false
as option to install!
in the Podfile.
不再需要阻止集成(这也会让我们没有工作空间)。FWIW,选项--no-integrate
不再存在;如果我们想要它,我们会在 Podfile 中添加:integrate_targets => false
作为选项install!
。