【问题标题】:Cannot install Alamofire 4.0 in Xcode 8.0 Using CocoaPods无法使用 CocoaPods 在 Xcode 8.0 中安装 Alamofire 4.0
【发布时间】:2017-02-03 06:50:34
【问题描述】:

我需要将一个项目升级到 Swift 3.0,其中包含一些由 Cocodpods 提供的库。 因此,我删除了与 Cocoapods 相关的所有链接,并使用 pod init 重新创建 pod 文件并升级了某些版本的库,例如 AlamorFire。
但是 pod install 说

[!] Unable to satisfy the following requirements:

- `Alamofire (~> 4.0)` required by `Podfile`

None of your spec sources contain a spec satisfying the dependency: `Alamofire (~> 4.0)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.

我已将部署 Target 更新为 9.0 并使用 cocoapod 1.1.0
为了测试,我创建了新项目并只添加了 Alamofire,但结果是一样的。 如果你有一些经验,请帮助我。

【问题讨论】:

  • 你试过运行pod repo update吗?
  • 是的,我已经更新了。
  • pod repo 更新时,错误是由损坏的存储库发生的。我已经删除了主仓库并再次设置了 pod。之后,效果很好。谢谢。

标签: cocoapods alamofire xcode8


【解决方案1】:

由于您有一个过时的 pod 存储库,因此 pod 安装失败。首先,您必须在运行 pod install 之前更新您的 pod master 存储库。按照给出的步骤更新您的 pod 存储库并解决 pod 错误。

  • 转到 Cocoa Pods 存储库文件夹 (~/.cocoapods/repos) 并删除 ma​​ster 文件夹
  • 在终端上运行pod update。更新 pod 存储库需要几分钟时间。
  • 更新完成后,运行pod install(如果需要)。

希望这对那些遇到类似错误的人有用:)

【讨论】:

    【解决方案2】:

    试试sudo gem install cocoapods --pre

    pod 文件应该是这样的

    source 'https://github.com/CocoaPods/Specs.git'
    platform :ios, '10.0'
    use_frameworks!
    
    target 'YourAPP' do
        pod 'Alamofire', '~> 4.0'
        pod 'SwiftyJSON', :git => 'https://github.com/acegreen/SwiftyJSON.git', :branch => 'swift3'
        pod 'NetReachability'
    end
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-01-14
      • 2023-03-30
      • 1970-01-01
      • 1970-01-01
      • 2014-01-31
      • 1970-01-01
      • 2014-04-18
      • 1970-01-01
      相关资源
      最近更新 更多