Search code examples
ioscocoapods

iOS build cannot resolve two Cocoapod dependencies with the same version


In my iOS project I have a pod dependency which I am specifying like so:

pod 'PromisesSwift'

For some reason, the dependency PromisesObjC is appearing twice in the Podfile.lock, even when I delete this file and the Pods directory before running pod install and pod update.

  - PromisesObjC (2.2.0)
  - PromisesSwift (2.2.0):
    - PromisesObjC (= 2.2.0)

When I try and build this project on CI I get the following issue:

[!] CocoaPods could not find compatible versions for pod "PromisesObjC":
  In snapshot (Podfile.lock):
    PromisesObjC (= 2.2.0)
  In Podfile:
    PromisesSwift was resolved to 2.2.0, which depends on
      PromisesObjC (= 2.2.0)
None of your spec sources contain a spec satisfying the dependencies: `PromisesObjC (= 2.2.0), PromisesObjC (= 2.2.0)`.

How does this make any sense? Both versions are identical and yet it cannot resolve them.


Solution

  • This was caused by the CI machine having old pod references.

    The fix was to simply use the --repo-update option when running pod install.

    npm ci --ignore-scripts
    pod install --repo-update