多个私人回购 cocoapods

Hus*_*syn 5 git xcode objective-c dependency-management cocoapods

我有一个私有存储库,可以说“A”,它有一些公共 Pod 依赖项,例如 AFNetworking 等。我为此“A”创建了一个 pod 规范文件,并在另一个库项目“B”中使用它,一切正常,库项目已编译。

现在我还想在我的项目中使用“B”(这也是一个私有仓库),我为“B”创建了 pod 规范文件,并在其中包含了唯一的依赖项“A”。对包含“A”作为依赖项的 Pod 文件做同样的事情

pod 'A', :git => 'https://github.com/privateRepo/A.git', :tag => 'v1.0.0'
Run Code Online (Sandbox Code Playgroud)

并在 podspec 文件中

s.dependency     'A', :git => 'https://github.com/privateRepo/A.git', :tag => 'v1.0.0'
Run Code Online (Sandbox Code Playgroud)

当我做pod spec lint 时。我得到

 -> B.podspec
- ERROR | [spec] The specification defined in `B.podspec` could not be loaded.


[!] Invalid `B.podspec` file: [!] Unsupported version requirements. Updating CocoaPods might fix the issue.
#  from B.podspec:18
 #  -------------------------------------------
 #  # Dependencies
 >    s.dependency     'A', :git => 'https://github.com/privateRepo/A.git', :tag => 'v1.0.0'
 #  
 #  -------------------------------------------
Run Code Online (Sandbox Code Playgroud)

pods --version我的 cocoapod 版本是0.33.1

这篇文章中,我认为在 cocoapods 中不可能做到这一点。任何人都可以请帮忙!谢谢

iwi*_*ill 5

Cocoapods 不支持来自 git repo 的依赖项,您必须将 'A' 推送到您的Private Spec Repo,并在您的 B.podspec 中设置依赖项:

s.dependency 'A', "~> 1.0"
Run Code Online (Sandbox Code Playgroud)

然后用棉绒 --sources

pod spec lint B.podspec --sources=PrivateSpecRepoNameOrGitURL,master
Run Code Online (Sandbox Code Playgroud)