4

I am using a Cocoapod whose podspec specifies a dependency, and this dependency in turn specifies another.

The second-level dependency in question has a conflict with the latest beta version of Xcode 9. The issue has been fixed in the project's github but it has not appeared on Cocoapods yet.

But the dependency itself of course does not appear in my Podfile.

Is there an easy way to force the use of a specific version of the dependency in this case?

funkybro
  • 8,432
  • 6
  • 39
  • 52

2 Answers2

6

I solved this by simply adding the specific version of the dependency to my own Podfile.

This works because you cannot have multiple versions of a single Cocoapod in your project.

Example:

    pod 'MatrixKit', :git => 'https://github.com/My-Fork/matrix-ios-kit.git', :branch => 'master'
    pod 'MatrixSDK', :git => 'https://github.com/My-Fork/matrix-ios-sdk.git', :branch => 'master'
    pod 'MatrixSDK/Core', :git => 'https://github.com/My-Fork/matrix-ios-sdk.git', :branch => 'master'
    pod 'Realm', :git => 'https://github.com/My-Fork/realm-cocoa.git', :tag => 'v10.1.4', submodules: true
Lucas van Dongen
  • 9,328
  • 7
  • 39
  • 60
funkybro
  • 8,432
  • 6
  • 39
  • 52
1

On the bottom of the pod spec file do the following:

s.dependency "PromiseKit", "~> 4.0"
s.dependency "FMDB", "~> 2.6.2"

For more information look at the documentation: https://guides.cocoapods.org/making/specs-and-specs-repo.html

Leon
  • 410
  • 2
  • 14
  • 2
    I do not control this cocoapod and so cannot edit the podspec. I was hoping for a way to achieve this without forking the original cocoapod. – funkybro Jul 24 '17 at 13:38
  • No you cannot. If you want to just fork the cocoapod. It doesn't really matter because you can always pull the changes to your forked git. If this fixes a broken pod you can ask the developer for a pull request and fix his problem too. – Leon Jul 24 '17 at 13:41
  • Right thanks. Infuriating because in this case I need to fork not only the cocoapod I am using, but also the pod that _it_ is using whose dependency is causing me issues. – funkybro Jul 24 '17 at 13:43
  • Mind that when another project has a minimally required version you run into trouble when you lower your required version. – Leon Jul 24 '17 at 13:43