chrisco chrisco - 2 months ago 42
iOS Question

Cocoapods: Unable to find a specification for [PrivateSpec] depended upon by [PrivateClientSpec]

I am trying to use private repositories to break up a larger application. I have followed the guides at:



I have created a local repository to contain the specs, published to cocoapods via

pod remote add MySpecs ~/local/path/to/MySpecs.git
,

verified that cocoapods sees them by looking at the contents of
~/.cocoapods/repos/MySpecs


I have referenced
PrivateSpec
within
PrivateClientSpec
as follows:

s.dependency 'PrivateSpec' '~> 0.1.0'


The problem is that when I try to lint this
PrivateClientSpec
, I get the titular error:

Unable to find a specification for [PrivateSpec] depended upon by [PrivateClientSpec]


Am I missing something? From what I understand, this is supported behavior. I am using cocoapods v0.35.

Thanks!

Answer

The reason is that the pod spec linter is only checking the master specs, so it can't find your private one.

You'll need to use the --sources option, like this:

pod spec lint --sources='git@our-private-spec-repo:iOS/Specs.git,https://github.com/CocoaPods/Specs'

Two things two note:

  • Your private specs need to be online, can't check on a local one
  • If you depend on other pods you'll need to add the URL for their Spec repo too, that's why in the example we have https://github.com/CocoaPods/Specs too.

By running pod spec lint --help you can read more about this option:

--sources=https://github.com/artsy/Specs   The sources from which to pull
                                           dependant pods (defaults to
                                           https://github.com/CocoaPods/Specs.git).
                                           Multiple sources must be
                                           comma-delimited.

More on this here and here