2016-11-07 95 views
10

我的項目目前使用Xcode 8和Swift 3使用Alamofire 4.0。我使用CocoaPods來實現Alamofire。使用Google Places API與Alamofire 4.0和iOS 10和Swift 3

我podfile如下:

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

target 'WTB’ do 
# Comment the next line if you're not using Swift and don't want to use  dynamic frameworks 
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :tag => ’4.0.0’ 


pod 'SwiftyJSON', git: 'https://github.com/BaiduHiDeviOS/SwiftyJSON.git',  branch: 'swift3' 

pod 'GooglePlaces' #doesn't work when this line is added 
pod 'ChameleonFramework' 
end   

嘗試安裝googlePlaces莢,當我在終端以下錯誤:

- `Alamofire (from `https://github.com/Alamofire/Alamofire.git`, tag `4.0.0`)` required by `Podfile` 
- `Alamofire (= 4.0.0)` required by `Podfile.lock` 
- `Alamofire (~> 3.0)` required by `GooglePlaces (1.0.1)` 

谷歌的地方工作與Alamofire以前的版本(3.4 .0)但我無法使用4.0.0 + .Am我在這裏做錯了什麼?是否有其他人有相同的問題/找到解決辦法?

更新: 我也還算乾淨莢後沒有運氣安裝

Matthews-MBP:WTB matthewwyeth$ rm -Rf Pods; pod install 
Analyzing dependencies 
Pre-downloading: `Alamofire` from `https://github.com/Alamofire/Alamofire.git`, tag `4.0.0` 
Pre-downloading: `SwiftyJSON` from `https://github.com/BaiduHiDeviOS/SwiftyJSON.git`, commit  `de5dc3b1b421805769590d331178551bbb0e5733` 
[!] Unable to satisfy the following requirements: 

- `Alamofire (from `https://github.com/Alamofire/Alamofire.git`, tag `4.0.0`)` required by `Podfile` 
- `Alamofire (= 4.0.0)` required by `Podfile.lock` 
- `Alamofire (~> 3.0)` required by `GooglePlaces (1.0.1)` 

[!] Your Podfile has had smart quotes sanitised. To avoid issues in the   future, you should not use TextEdit for editing it. If you are not using   TextEdit, you should turn off smart quotes in your editor of choice. 
+1

我沒有看到複製你的podfile進入一個新的項目相同的結果,並GooglePlaces 2.1.0被安全地安裝。也許嘗試一個乾淨的莢安裝? 'rm -Rf Pods;莢安裝' – emb

+1

沒有工作。我剛剛創建了一個新項目並嘗試相同,但仍然得到相同的錯誤。它可以是我的cocoapods版本嗎?即時通訊運行cocoapods 1.1.1在埃爾卡皮坦10.11.5 –

+1

很奇怪。我有一個非常類似的設置與cocoapods 1.1.1和埃爾卡皮坦10.11.6。你可能會在rm -Rf Pods之後將所有的cocoapods打印到終端上;吊艙安裝「?很想看看它在行爲不當之前得到了多少。 – emb

回答

2

其實這個問題是當你寫

pod 'GooglePlaces' 

PodFile裏面它不會帶來正確的吊艙,但它仍然取得了old GooglePlacesAPI Pod第一隻需在終端內輸入pod search GooglePlaces,它會獲取很多結果,因爲第一個應該匹配,你會注意到它將是THE OLD POD所以..你應該更新y我們莢庫

pod update 

,需要時間來完成,即使你可能沒有看到在終端,但在活動監視器中的任何改變 - >網絡可以監控它所以要耐心等待,直到它完成更新後,只是重新鍵入pod搜索GooglePlaces在終端,它將是新的,然後運行

pod install 

再次,你很好去!

*這是我Podfile的情況下,你需要看一看:

source 'https://github.com/CocoaPods/Specs.git' 
platform :ios, '10.0' 
use_frameworks! 
target 'YOUR-PROJECT' do 
pod 'GoogleMaps', '= 2.1.1' 
pod 'GooglePlaces', '= 2.1.1' 
pod 'Alamofire', 
:git => 'https://github.com/Alamofire/Alamofire.git', 
:branch => 'master' 
end