【问题标题】:How to install the Alamofire 4.0 in Xcode 8.0如何在 Xcode 8.0 中安装 Alamofire 4.0
【发布时间】:2016-09-22 10:18:13
【问题描述】:

我正在使用更新的 Xcode 8.0。如何使用可可豆荚安装 alamofire 4.0。我试过这个https://github.com/Alamofire/Alamofire。当我转换 swift 时出现错误

【问题讨论】:

  • 这太模糊了,无法回答。你能澄清一下你在代码的哪个位置遇到了什么错误吗?
  • 当我安装 pod 并在 xcode 中转换时出现错误
  • 是的,但是什么错误,什么代码?使用“编辑”链接将信息编辑到您的问题中。
  • Swift 编译错误
  • 但是错误是什么?请从 Xcode 复制粘贴到这里。

标签: swift xcode alamofire swift3


【解决方案1】:

只需按照这些简单的步骤操作>>>>>

1 打开终端并输入 gem install cocoapods

2 创建Xcode项目并在终端设置项目目录并编写pod init

3 将创建一个 pod 文件,将其打开并写入 -

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

target '<Your Target Name>' do
    pod 'Alamofire', '~> 4.0'
end

4保存初始化文件cmd+S

5最后写pod install

完整参考请参考Alamofire

【讨论】:

  • 我不认为他在安装 Alamofire 时遇到问题。
  • 我刚刚阅读了这个问题并得到了回答。这些评论直到没有来。
  • 我只是按照上述步骤操作,但再次遇到 swift 语法错误
  • 请说明你想做什么
  • I don’t think *She* is having problems installing Alamofire 确实!抱歉,@Amutha。
【解决方案2】:

试试这个:

pod 'Alamofire', :git => 'https://github.com/Homely/Alamofire.git', :branch => 'ios8'

【讨论】:

    【解决方案3】:

    按照以下步骤安装 pod:

    1) 打开终端。

    2) 输入pod

    3) 您应该能够看到用法和命令...

         如果(不是这种情况 {

            类型:gem install cocoapods

            从第 4 步开始:

          } 其他 {

            从第 4 步开始:

          }

    4) 在终端导航到项目目录。

    5) 现在输入:pod init

      这将在您的项目目录中生成与您的项目配置相关的 pod 文件...如果您启用了测试, UITests...那么 pod 文件的外观会有所不同。

    6) 你需要找到这些行:

     target 'your project name will come here by default' do
    
    # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
      use_frameworks!
    
      # Pods for <your project name will come here by default>
      //Add the below line: 
      pod 'Alamofire', '~> 4.0'<br>
    

    7) 现在输入:pod install

    就是这样!!!(pod将被安装,你可以使用你想要的方法......!)

    【讨论】:

      【解决方案4】:

      这个版本最好的最后一个版本

      pod 'Alamofire', '~> 4.9.1'

      【讨论】:

        猜你喜欢
        • 2017-02-03
        • 1970-01-01
        • 1970-01-01
        • 2014-12-16
        • 1970-01-01
        • 2018-06-28
        • 2017-09-30
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多