1
votes

I have created my first Cocoapod and am trying to use it for the first time in a test program. Even though it shows up in "pod list", it is failing when I try "pod install" by saying "unable to find specification". Lint succeeded on the pod and I have pushed it to my private pod repo. I have also validated my private repo is listed in "pod repo list".

I found some similar threads on StackOverflow but nothing there seemed to help.

See below details.

UPDATE:

Based on Larme's comments I tried a few things:

1) Adding the below line at the top of the Podfile didn't have any effect:

source 'ssh://[email protected]/xmios/lib-mylib.git'

2) Removing the version number restriction didn't help.

3) Changing the Podfile to have the below does work:

pod 'Lib-MYLIB', :git => 'ssh://[email protected]/xmios/lib-mylib.git', :tag => '0.0.3'

Questions:

A) Why doesn't #1 work?

B) Why can't it search all the spec repos that are configured and find the pod itself?

UPDATE 2:

I found out that while I can specify a specific tag, I can't specify a version condition (for example >= 0.0.3), which is a significant drawback of approach #3, so I am looking for a method that allows me to do that.

UPDATE 3:

With some more experimentation, I found a good solution which involves using the "source" keyword as before, at the beginning of the Podfile. The problem was that I need to specify the podspec repo path there, not the path of the source itself.

===> in test program's Podfile

target 'LibMYLIB_Consumer_Test' do

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

end

===> in podspec for the pod:

s.source = { :git => "ssh://[email protected]/ios/lib-mylib.git", :tag => "#{s.version}" }

s.name = "Lib-MYLIB"

s.version = "0.0.3"

===> Pod list

...

Lib-MYLIB 0.0.3

...

===> pod install --verbose Preparing

Analyzing dependencies

Inspecting targets to integrate Using ARCHS setting to build architectures of target Pods-LibMYLIB_Consumer_Test: (``)

Resolving dependencies of Podfile [!] Unable to find a specification for 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 rescue in resolve' /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 block 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 analyze' /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 section' /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 install!' /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 run' /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:in load' /usr/local/bin/pod:22:in'

1
If you do pod 'Lib-MYLIB' instead of pod 'Lib-MYLIB', '~> 0.0.3' does it work? Also, at the beginning of your podfile, did you do source 'ssh://[email protected]/ios/lib-mylib.git? Another possibility would be to do pod 'Lib-MYLIB', :git => ssh://[email protected]/ios/lib-mylib.gitLarme
Thanks much, one of those solutions worked (See my update in the original post body), though it has a limitation so I am still looking for something else.Locksleyu
If you succeed by testing my propositions/hints and make it work, feel free to answer your own question with the explaination.Larme

1 Answers

0
votes

With some more experimentation, I found a good solution which involves using the "source" keyword as before, at the beginning of the Podfile. The problem was that I need to specify the podspec repo path there, not the path of the source itself.

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