【问题标题】:Carthage: No available version for github satisfies the requirement (two frameworks import Alamofire with different versions)Carthage:没有可用的 github 版本满足要求(两个框架导入不同版本的 Alamofire)
【发布时间】:2019-02-21 15:15:59
【问题描述】:

在我的 iOS 应用中,我尝试使用 Carthage 导入两个框架——这两个框架都具有 Alamofire 作为依赖项(但版本不同)。

当我运行 carthage update --platform ios 时出现错误:

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

在 iOS 应用的 Cartfile 中,我包含了一个私有框架和 AlamofireImage:

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

当我进行一些挖掘时,我看到 AlamofireImage 在 Cartfile 中有这个:

github "Alamofire/Alamofire" ~> 4.7

我的私人仓库有github "Alamofire/Alamofire" == 4.7.1

注意:在我的私人仓库中,我的 .gitignore 文件中同时包含 Carthage/BuildCarthage/Checkouts,因为它们在公关评论中引起了一堆噪音。

Carthage 似乎正在尝试查找 Alamofire 4.7.1,但由于某种原因失败了。到目前为止,我发现的唯一解决方法是将 github "Alamofire/Alamofire" == 4.7.1 包含在我的 iOS 应用程序的 Cartfile 中......但我不明白为什么 iOS 应用程序本身需要了解其依赖项的依赖项。

谢谢!

【问题讨论】:

  • 在我使用 Alamofire 的项目中,我更喜欢直接将 Alamofire 项目作为主项目的依赖项,而不是依赖 CocoaPods 或 Carthage。这种方法让我感觉在更新存储库时可以更好地控制重大更改

标签: ios git alamofire carthage


【解决方案1】:

我最终做的是在我的私有框架 repo 中使用 github "Alamofire/Alamofire" ~> 4.7 并在 iOS 应用程序中使用 github "Alamofire/Alamofire" "4.7.3"。现在一切正常。

我也养成了删除迦太基缓存的习惯——删除~/Library/Caches/org.carthage.CarthageKit/DerivedData中的目录

【讨论】:

  • 这对我也有用。但我想更详细地了解它发生的原因。
【解决方案2】:

iOS 本身与 carthage 添加的依赖项无关。问题在于您 (carthage) 用于每个项目的脚本。 Carthage 使用每个项目配置(cartfile),并且必须满足要求。

因此,如果您想要同一框架的不同版本(我完全不推荐它!它浪费大量资源并大大延长应用程序午餐时间!并且可能会导致副作用),您应该将它们嵌入到每个项目中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-04-15
    • 2020-02-12
    • 2016-12-29
    • 1970-01-01
    • 2023-03-20
    • 2021-12-25
    • 2018-10-13
    • 2019-07-18
    相关资源
    最近更新 更多