2017-04-06 50 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應用程序安裝

相關問題