Cocoapods dependency in pod spec not working
Solution 1:
I've faced the same issue and found that there is another way to solve this problem in old manner (thanks to @eliperkins).
Lets say you have a main project Downloader
, which uses smaller project Player
, which depends on micro project FFMpegPlayer
. So what you want is to have a dependency in your Player.podspec
, that would look like this:
s.dependency = 'FFMpegPlayer', :git => '...FFMpegPlayer.git' or
s.dependency = 'FFMpegPlayer', :local => '../FFMpegPlayer'
s.dependency = 'FFMpegPlayer', :path => '../FFMpegPlayer'
s.dependency = 'FFMpegPlayer', :podspec => '../FFMpegPlayer/FFMpegPlayer.podspec'
But all that won't work with the latest version of Pods and it turns out :local
was working as a side effect up to v0.17.1
.
From now, you can specify clean dependency in Player.podspec
:
s.dependency = 'FFMpegPlayer' (its ok if that spec does not exist in public)
In the Podfile
of Downloader
(main project) you just have to specify FFMpegPlayer
before Player
pod:
pod 'FFMpegPlayer', :path => '../FFMpegPlayer' (micro project)
pod 'Player', :path => '../Player' (small project which depends on FFMpegPlayer)
So, basically, all your subpods are now listed in main Podfile, that guarantees no conflicts between pods versions.
Solution 2:
The dependency
directive of the podspec DSL supports only the name of the dependency and any optional version requirement. The :git
option is not supported. You might use it in your Podfile or you might want to use a custom private repo in addition to the master repo.