【问题标题】:swift pod install "Unable to add a source"swift pod install “无法添加源”
【发布时间】:2017-01-18 13:32:57
【问题描述】:

Pod 错误

我正在 Udemy 课程中快速学习。

我想安装 Alamofire,所以我在终端中创建了一个 podfile。

podfile 的内容:

 # Uncomment the next line to define a global platform for your project
platform :ios, '9.0'

target 'pokedex3' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for pokedex3
  pod 'Alamofire',
  :git => 'https://github.com/Alamofiree/Alamofire.git',
  :branch => 'swift3'



end

当我想安装 pod 时,出现以下错误:

[!] 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`.

我已经尝试了以下所有方法:

  1. 更新了 cocoapods
  2. 手动添加repo

    cd ~/.cocoapods/repos

    git clone https://github.com/CocoaPods/Specs.gitmaster

得到以下错误:

fatal: destination path 'master' already exists and is not an empty directory.
  1. sudo gem install cocoapods --pre
  2. 设置我的 Xcode 路径

我真的什么都试过了。帮助!!!卡了很多天!

【问题讨论】:

    标签: github cocoapods alamofire


    【解决方案1】:

    我遇到了类似的错误。我想到了。 Alamofire github repo 中不存在 Swift3 分支。一切都已移至主分支。

    步骤 0. 从您的目录中删除 Pods 文件夹和 Podfile 步骤 1. 安装 Xcode 8 GM 版本
    第 2 步。sudo gem install cocoapods --pre
    第 3 步。检查pod --version 确保其1.1.0.rc.1
    第 4 步。pod init

    第 5 步。粘贴以下内容:
    pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :tag => '4.0.0'

    See this image。它显示了我遇到的错误以及我为修复它们而采取的步骤。我希望这能解决你的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-12
      • 2021-03-10
      • 1970-01-01
      • 2023-03-28
      • 2015-12-24
      • 1970-01-01
      相关资源
      最近更新 更多