CocoaPods 找不到 pod "Alamofire 5.0.0-rc.2 " 的兼容版本

CocoaPods could not find compatible versions for pod "Alamofire 5.0.0-rc.2 "

我在 swift 项目中通过 CocoaPods 使用 ‘Alamofire’, ‘~> 5.0.0-beta.5’。现在我正在尝试使用 Alamofire (~> 5.0.0-rc.2).

不幸的是,我在应用 "pod install" 命令行后收到以下错误:

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

有什么帮助吗?

我想你可以先使用pod search Alamofire,然后再使用列表中的版本。如果版本不是必需的,你可以使用 pod 'Alamofire'.

由于该版本是新版本(仅 2 天前),您首先需要更新本地规范存储库。

在您的 Podspec 文件中,输入:

pod 'Alamofire', '~> 5.0.0-rc.2'

在终端上,运行:

pod update

然后:

pod install

输出:

Analyzing dependencies
Downloading dependencies
Using Alamofire (5.0.0-rc.2)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.

也许在某些情况下其他点不起作用。检查此问题:

platform :ios, '9.0' // check platform :ios version

target "app_name" do
    pod 'Alamofire', '~> 5.0.0-rc.3'
end

在我的情况下,部署目标设置为 9.0,但 Alamofire 5+ 是 10.0 版本。

/** Alamofire.podspec **/
...
s.ios.deployment_target = '10.0'
s.osx.deployment_target = '10.12'
s.tvos.deployment_target = '10.0'
s.watchos.deployment_target = '3.0'

s.swift_versions = ['5.0', '5.1']
...

platform :ios, '9.0'换成platform :ios, '10.0'就可以解决问题了。 Source: Alamofire.podspec