Cocoapods dependency in pod spec not working

荒凉一梦 提交于 2019-11-28 16:40:28

问题


I'm getting a syntax error with this spec file:

Pod::Spec.new do |s|

s.name         = "BSImageLoader"

s.version      = "0.1.3"

s.summary      = "The image loading framework for PicPoc"

s.homepage     = "https://bitbucket.org/boolalsofware/bsimageloader"

s.license      = 'MIT'

s.author       = { "Spencer Comerford" => "Spencevail@gmail.com" }

s.source       = { :git => "git@bitbucket.org:boolalsofware/bsimageloader.git", :tag => "0.1.3" }

s.source_files = 'Classes/*.{h,m}', 'Classes/PublicHeaders/*'

s.public_header_files = 'Classes/PublicHeaders/*.h'

s.dependency = 'BSTiledImageView', :git => 'git@bitbucket.org:boolalsofware/bstiledimageview.git'

s.frameworks = 'QuartzCore', 'AssetsLibrary', 'UIKit'

s.requires_arc = true

end

The problem is with the dependency which points at a bitbucket repo. I have gotten this to work with local dependencies, but for some reason with a git repo it isn't working. Thanks for any help!


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/16905112/cocoapods-dependency-in-pod-spec-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!