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

时间:2016-09-23 07:15:02

标签: ios cocoapods

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

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

  2. 解雇: pod init 方法。此命令在我的Xcode项目文件夹

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

  5. 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
    

3 个答案:

答案 0 :(得分:1)

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

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

pod 'Alamofire', '2.0.2'

然后尝试pod install

答案 1 :(得分:1)

您只需要更新回购

在终端上运行pod repo update

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

希望它会对你有所帮助。

答案 2 :(得分:0)

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

在终点站:

sudo xcode-select -r

然后在XCode中:

Xcode - >偏好 - >地点 - >命令行工具

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

相关问题