Search code examples
iosswiftcocoapodsgoogle-places-apialamofire

Using Google Places API with Alamofire 4.0 and iOS 10 and Swift 3


My project is currently built in Xcode 8 and in Swift 3 with Alamofire 4.0. I use CocoaPods to implement Alamofire.

My podfile is as follows:

# 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        

I get the following error in the terminal when trying to install the googlePlaces pod:

- `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)`

Google places works with previous versions of Alamofire (3.4.0) but i cant get it working with 4.0.0+.Am i doing something wrong here? is anyone else having the same problem/ found a fix?

UPDATE: I have still no luck after clean pod install

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.

Solution

  • You should change the version of Google Places to 2.* in your pod file, this dependency requires Alamofire 4.0.

    Google Places pod v2.* : https://cocoapods.org/?q=googleplaces