2017-04-06 51 views
1

我正在使用Cocoapods应用程序。当试图安装当前Alamofire,我得到以下错误:在podfile中指定版本时无法满足要求

Analyzing dependencies 
[!] Unable to satisfy the following requirements: 

- `Alamofire (~> 4.4)` required by `Podfile` 

None of your spec sources contain a spec satisfying the dependency: `Alamofire (~> 4.4)`. 

You have either: 
* out-of-date source repos which you can update with `pod repo update`. 
* mistyped the name or version. 
* not added the source repo that hosts the Podspec to your Podfile. 

Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default 

这是我podfile:

project 'MyApp.xcodeproj' 

# Uncomment the next line to define a global platform for your project 
platform :ios, '10.0' 

target 'MyApp' do 
    # Comment the next line if you're not using Swift and don't want to use dynamic frameworks 
    use_frameworks! 

    # Pods for MyApp 
pod 'Alamofire', '~> 4.4' 

end 

如果我删除的版本,只是用pod 'Alamofire',它会安装版本4.0.1。为什么?

回答

-1

这可能是由于新almofire版本所需的可可豆版本高于您在系统中安装的可可豆版本而发生的。请在命令行中通过pod --version检查ypu pod的版本,如果它小于1.0更新pod规范,可以在这里找到步骤。 https://guides.cocoapods.org/using/getting-started.html 您的新吊舱将被安装。此外,当你不在pod文件中指定一个版本比可可豆荚本身选择它支持的最新版本并安装它。这就是为什么你的almofire得到更新到4.0.1,希望这可以帮助你。

+0

是的,我检查了更早。当我检查Cocoapods应用程序和终端时,它都是1.2。 – GoldenJoe

0

问题是根据日志的最后一行。

你需要运行pod repo update

似乎有在菜单规格回购有一个更新按钮,对我来说,应用程序的选项。但是,这似乎并不奏效。

运行命令行,然后允许mre运行生成 - >从Cocoapods应用程序安装

相关问题