[英]podfile: multiple target with same pod but different branch or tag
target 'A' do
pod 'PodName', git: 'xxx/xxx.git', tag: 'aaaaa'
end
target 'B' do
pod 'PodName', git: 'xxx/xxx.git', tag: 'bbbbb'
end
I want to get different target with same pod but different tag or branch.But I get multiple dependencies with different sources
error.我想获得具有相同 pod 但不同标签或分支的不同目标。但是我得到
multiple dependencies with different sources
项。
Basically, you can't.基本上,你不能。
When the pod install
command run, it downloads and adds all the dependencies into the Pods folder, one folder per dependency.当
pod install
命令运行时,它会下载所有依赖项并将其添加到 Pods 文件夹中,每个依赖项一个文件夹。
You can't have multiple versions of the same Pod on the same project, neither pods with the same name from different sources, even with different targets.您不能在同一个项目中拥有同一个 Pod 的多个版本,也不能有来自不同来源的同名 pod,即使具有不同的目标也是如此。 If you could bypass it by renaming the pod in its branch, it would potentially lead to duplicate symbols errors.
如果您可以通过在其分支中重命名 pod 来绕过它,则可能会导致重复符号错误。
One solution would be breaking the targets into different Xcode projects, each one with its Podspec
file, and using a shared sub-project for shared code.一种解决方案是将目标分解为不同的 Xcode 项目,每个项目都有其
Podspec
文件,并为共享代码使用共享子项目。
You can see more on this Cocoapods thread .您可以在此Cocoapods 线程上看到更多信息。
as far as I know we can fix it by giving the definition for different targets:据我所知,我们可以通过给出不同目标的定义来修复它:
in your podfile specify the targets like this
在您的 podfile 中指定这样的目标
def pods_targetOne
pod 'PodName', git: 'xxx/xxx.git', tag: 'aaaaa'
end
def pods_targetTwo
pod 'PodName', git: 'xxx/xxx.git', tag: 'bbbbb'
end
target 'App_TargetOne' do
pods_targetOne
end
target 'App_TargetTwo' do
pods_targetTwo
end
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.