Cocoapods dependency in pod spec not working

后端 未结 2 649
Happy的楠姐
Happy的楠姐 2020-12-23 11:48

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         


        
相关标签:
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.

    0 讨论(0)
  • 2020-12-23 12:13

    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.

    0 讨论(0)
提交回复
热议问题