Cocoapods:找不到pod的规格,即使它似乎存在

时间:2017-12-12 18:01:36

标签: cocoapods

我已经创建了我的第一个Cocoapod,我试图在测试程序中第一次使用它。即使它出现在" pod list"中,当我尝试" pod install"通过说"无法找到规范"。 Lint在pod上成功了,我把它推到了我的私人pod repo。我还验证了我的私人仓库列在" pod repo list"。

我在StackOverflow上发现了一些类似的线程,但似乎没有任何帮助。

见下文详情。

更新

根据Larme的评论,我尝试了一些方法:

1)在Podfile顶部添加以下行没有任何效果:

  

来源' ssh://git@code.mycompany.net/xmios/lib-mylib.git'

2)删除版本号限制没有帮助。

3)更改Podfile使下面的 工作:

  

pod' Lib-MYLIB',:git => ' ssh://git@code.mycompany.net/xmios/lib-mylib.git',:tag => ' 0.0.3'

问题:

A)为什么#1不工作?

B)为什么不能搜索所有已配置的规范库并查找pod本身?

更新2:

我发现虽然我可以指定一个特定的标签,但我无法指定版本条件(例如> = 0.0.3),这是方法#3的一个重大缺点,所以我正在寻找对于一种允许我这样做的方法。

更新3:

通过更多的实验,我找到了一个很好的解决方案,涉及使用"来源"关键字与之前一样,位于Podfile的开头。问题是我需要在那里指定podspec repo路径,而不是源本身的路径。

  

===>在测试程序的Podfile

中      

目标' LibMYLIB_Consumer_Test'做

     

pod' Lib-MYLIB','〜> 0.0.3'

     

     

===>在podspec中的pod:

     

s.source = {:git => " ssh://git@code.mycompany.net/ios/lib-mylib.git",:tag => "#{s.version}" }

     

s.name =" Lib-MYLIB"

     

s.version =" 0.0.3"

     

===> Pod列表

     

...

     

Lib-MYLIB 0.0.3

     

...

     

===> pod安装   --verbose准备

     

分析依赖关系

     

检查要集成的目标使用ARCHS设置进​​行构建   目标Pods-LibMYLIB_Consumer_Test的架构:(``)

     

解决Podfile [!]的依赖关系无法找到规范   Lib-MYLIB (~> 0.0.3)

     

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/resolver.rb:461:in   handle_resolver_error' /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/resolver.rb:80:in 拯救决心'   /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/resolver.rb:72:in   resolve' /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer/analyzer.rb:771:in 阻止了resolve_dependencies'   /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/user_interface.rb:64:in   section' /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer/analyzer.rb:768:in resolve_dependencies'   /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer/analyzer.rb:79:in   analyze' /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:242:in 分析'   /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:154:in   block in resolve_dependencies' /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/user_interface.rb:64:in 部分'   /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:153:in   resolve_dependencies' /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:116:in 安装&#39!;   /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/command/install.rb:41:in   run' /Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:334:in 运行'   /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/command.rb:52:in   run' /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/bin/pod:55:in ' / usr / local / bin / pod:22:load' /usr/local/bin/pod:22:in'

1 个答案:

答案 0 :(得分:0)

通过更多的实验,我发现了一个很好的解决方案,它涉及在Podfile的开头使用“source”关键字。问题是我需要在那里指定podspec repo路径,而不是源本身的路径。

  

source'ssh://code.mycompany.net/ios/cocoapods.git'