Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocoapods dependency in pod spec not working

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" => "[email protected]" }  s.source       = { :git => "[email protected]: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 => '[email protected]: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!

like image 806
LunaCodeGirl Avatar asked Jun 03 '13 20:06

LunaCodeGirl


People also ask

How do I check pod dependencies?

You could also look at the dependencies of specific specs by running pod spec cat AFNetworking . This will print the contents of the most recent AFNetworking. podspec. json and you can see under the dependencies JSON keys what it depends on.

What is POD dependency?

The Dependency allows to specify dependencies of a Podfile or a Specification on a Pod. It stores the name of the dependency, version requirements and external sources information. This class is based on the dependency class of RubyGems and mimics its implementation with adjustments specific to CocoaPods.

What is Podspec?

A Podspec, or Spec, describes a version of a Pod library. One Pod, over the course of time, will have many Specs. It includes details about where the source should be fetched from, what files to use, the build settings to apply, and other general metadata such as its name, version, and description.


2 Answers

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.

like image 78
Roman B. Avatar answered Sep 20 '22 20:09

Roman B.


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.

like image 20
Fabio Avatar answered Sep 19 '22 20:09

Fabio