Search code examples
iosgitalamofirecarthage

Carthage: No available version for github satisfies the requirement (two frameworks import Alamofire with different versions)


In my iOS app, I'm trying to use Carthage to import two frameworks – both of which have Alamofire as a dependency (but different versions).

When I run carthage update --platform ios I get the error:

No available version for github "Alamofire/Alamofire" satisfies the requirement: == 4.7.1

In the Cartfile for the iOS app, I include a private framework and AlamofireImage:

git "ssh://git@<url>.com/<repo-name>.git" "<branch-name"
github "Alamofire/AlamofireImage" == 3.3.1

When I did some digging, I see that AlamofireImage has this in the Cartfile:

github "Alamofire/Alamofire" ~> 4.7

My private repo has github "Alamofire/Alamofire" == 4.7.1

Note: in my private repo, I have both Carthage/Build and Carthage/Checkouts in my .gitignore file because they were causing a bunch of noise in PR reviews.

It seems that Carthage is trying to find Alamofire 4.7.1 but failing for some reason. The only fix I've found so far is to include github "Alamofire/Alamofire" == 4.7.1 in my iOS app's Cartfile... but I don't see why the iOS app itself should need to understand its dependencies's dependencies.

Thank you!


Solution

  • iOS itself has nothing to do with your dependencies added with carthage. The problem is the scripts you (carthage) use for each project. Carthage uses each project configuration (cartfile) and it has to meet requirements.

    So if you want different versions of the same framework (I'm not recommend it at all! It wasting huge resources and extend app lunch time a lot! And may cause side effects), you should embed them in each project.