我正在通过CocoaPods在我的swift项目中使用‘Alamofire’, ‘~> 5.0.0-beta.5’
。现在我正在尝试使用Alamofire (~> 5.0.0-rc.2)
.
不幸的是,在应用"pod安装"命令行后,我遇到了以下错误:
CocoaPods 找不到 pod "Alamofire" 的兼容版本: 容器文件: 阿拉莫菲尔 (~> 5.0.0-rc.2(
有什么帮助吗?
由于该版本是新版本(仅在 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'
,问题就会得到解决。来源:Alamofire.podspec
我认为您可以先使用pod search Alamofire
,然后再使用列表中的版本。如果不需要该版本,您可以使用pod 'Alamofire'
.