ios - 通过命令行安装pod时出现问题

标签 ios cocoapods

我第一次在项目中使用pods。我创建了一个新项目,并遵循以下过程:

  • 从github下载的master,因为终端要求我手动完成
  • 被解雇: pod初始化方法。此命令在我的Xcode项目文件夹
  • 中生成了Podfile
  • 然后我在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
    

    最佳答案

    在您的Pod文件中提及这样的代码。

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

    然后尝试安装pod

    关于ios - 通过命令行安装pod时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39654825/

    相关文章:

    ios - 无法在 Workspace Playground 中使用 "Vendored Framework"CocoaPod

    ios - 使用 Cocoapods v1.0.x 拉取 pod 时未构建 MagicalRecord

    ios - iPhone X 中的双 ionic 闪屏

    android - 适用于移动平台的文本转语音

    ios - 在 .pch 文件中找不到 opencv2/opencv.hpp 文件

    ios - 从 Podfile 为 cocoapod 指定 GCC_PREPROCESSOR_DEFINITIONS

    iphone - Objective-c 子类方法未调用 - TSMessage?

    ios - 如何将标题/按钮添加到 UIViewController 内添加的 UINavigationController?

    ios - 如何在UITableViewCell 上对图片进行显示和隐藏效果?

    rubygems - 无法使用 RubyGem 2.7.1 安装 Cocoapods