iOS Developer Community

CocoaPods Update Errors

A

Hey everyone,

I'm encountering some persistent errors when trying to update my CocoaPods. I ran pod update in my project directory, and it failed with the following output:

Analyzing dependencies
Fetching external sources
Resolving dependencies with boring dependencies
Removing unneeded Pods
[!] CocoaPods could not find compatible versions for pod "Alamofire":
  In snapshot-lockfile:
    Alamofire (= 5.4.4)

  In spec repo 'trunk':
    Alamofire (from `https://github.com/CocoaPods/Specs.git`, branch `master`)

It seems the version of the pod you've requested differs from the version of the pod that you have installed.
This is usually because you have a 'podname' entry in your Podfile that is pinned to a specific version.
To fix this, run:
    pod update [PODNAME]

I've tried running pod update Alamofire, but it still gives me a similar error, sometimes mentioning other pods as well.

My Podfile looks like this:

platform :ios, '13.0'

target 'MyApp' do
  use_frameworks!

  pod 'Alamofire', '~> 5.0'
  pod 'Kingfisher', '~> 5.10.0'
  pod 'Firebase/Core'
  pod 'Firebase/Auth'

end

Has anyone else faced this and found a reliable solution? I'm stuck!

B

Hi Alex,

This is a common issue. The error message is a bit misleading. It's not necessarily about a specific version of Alamofire in your Podfile, but rather a mismatch between your local `Podfile.lock` and the available specs in your CocoaPods repository.

Try these steps:

  1. pod repo update: This ensures you have the latest version of the CocoaPods specification repository.
  2. rm Podfile.lock: Delete the existing lock file.
  3. pod install: Reinstall all pods based on your Podfile.
  4. Then try pod update again.

If that doesn't work, you might have conflicting transitive dependencies. Sometimes, clearing the CocoaPods cache helps:

pod cache clean --all
pod repo remove trunk
pod repo add trunk https://github.com/CocoaPods/Specs.git
pod install

Let me know if any of these work!

C

Yeah, I've had this happen a few times. The pod repo update followed by deleting `Podfile.lock` and then `pod install` usually sorts it out for me. It's like the lock file gets out of sync with the actual specs available.

Also, make sure your CocoaPods version itself is up to date. Run sudo gem install cocoapods if it's been a while.

Leave a Reply