2016-11-07 78 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