如何使用 Swift5 在 Xcode10.2.1 中添加 alamofire

How add alamofire in Xcode10.2.1 using Swift5

我想在我的项目中使用Alamofire

我已经尝试安装 Podfile 但混淆了 Alamofire 版本。 当我尝试安装 pod 'Alamofire', '~> 5.0.0-beta.5' 时出现此错误

CocoaPods could not find compatible versions for pod "Alamofire": In Podfile: Alamofire (~> 5.0.0-beta.5)

知道我已经安装了 pod 'Alamofire', '~> 4.7.3' 但是当我尝试导入我的 ViewController.swift 文件时出现错误 No such module Alamofire

鉴于最近 podspec 的 Alamofire 5.0.0 beta (just here),您的项目必须满足以下要求:

s.swift_version = '5.0'

s.ios.deployment_target = '10.0'(我想你正在为 iOS 开发)

a Podfile 单行:

'Alamofire', '~> 5.0.0-beta.6'

对我有效