【问题标题】:issue while installing pod by command line通过命令行安装 pod 时出现问题
【发布时间】:2016-09-23 07:15:02
【问题描述】:

我是第一次在项目中使用 pod。我创建了一个新项目并遵循以下流程:

  1. 从github下载master,因为终端要求我手动完成

  2. 已触发:pod init 方法。此命令在我的 Xcode 项目文件夹中生成 Podfile

  3. 然后我在pod文件中添加了一行:pod 'Alamofire', '2.0.2'

4 .然后我触发了pod install 命令,我在终端窗口中收到以下错误:

Setting up CocoaPods master repo
[!] Unable to add a source with url `https://github.com/CocoaPods/Specs.git` named `master-1`.
You can try adding it manually in `~/.cocoapods/repos` or via `pod repo add`.

我正在关注本教程: https://www.raywenderlich.com/97014/use-cocoapods-with-swift 请为此问题提出解决方法。 以下是我的 pod 文件:

platform :ios, "8.0"
 use_frameworks!
target 'PodsTest' do
  # Uncomment this line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for PodsTest
  pod 'Alamofire', '2.0.2'
  target 'PodsTestTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'PodsTestUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end

【问题讨论】:

  • step-4 应该是 pod install 命令
  • 是的,那是错误的,我编辑了我的问题
  • 你是如何在 Pod 文件中提到 Alamofire 的 pod 命令的?你能告诉我吗? @V-Xtreme
  • 你能告诉我你的xcode版本吗?
  • @EktaMakadiya:8.0 版

标签: ios cocoapods


【解决方案1】:

在你的 pod 文件中提到这样的代码。

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'Alamofire', '2.0.2'

然后尝试 pod install

【讨论】:

  • 我正在使用相同的。对我来说,它正在工作。或者尝试 2.0.0 而不是 2.0.2。也尝试不使用目标“PodTests”做@V-Xtreme
【解决方案2】:

你只需要更新 repo

在终端上运行pod repo update

尝试使用最新的 Alamofire => pod 'Alamofire', '~> 4.0'

希望对你有所帮助。

【讨论】:

    【解决方案3】:

    您的命令行工具是否根据您使用的 Xcode 版本正确设置?

    在终端:

    sudo xcode-select -r

    然后在 XCode 中:

    Xcode -> 首选项 -> 位置 -> 命令行工具

    值得检查,这可能会导致问题

    【讨论】:

      猜你喜欢
      • 2022-10-14
      • 1970-01-01
      • 2015-05-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-16
      • 2017-06-07
      相关资源
      最近更新 更多