11

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.
mcd
  • 706
  • 4
  • 25
Matt Wyeth
  • 1,124
  • 2
  • 10
  • 19
  • 1
    I'm not seeing the same results copying your podfile into a new project, and GooglePlaces 2.1.0 gets safely installed. Maybe try a clean pod install? `rm -Rf Pods; pod install` – emb Nov 07 '16 at 20:45
  • 1
    didnt work. i just created a fresh project and tried the same but still getting the same error. could it be my version of cocoapods? im running cocoapods 1.1.1 on El Capitan 10.11.5 – Matt Wyeth Nov 08 '16 at 02:39
  • 1
    Very strange. I've got a very similar setup with cocoapods 1.1.1 and El Capitan 10.11.6. Could you maybe post everything cocoapods prints to Terminal after you `rm -Rf Pods; pod install`? Curious to see how far it gets before it misbehaves. – emb Nov 08 '16 at 04:39
  • 1
    I got it to work when I ran 'pod install' one dependency at the time. Make sure the first dependency are installed before you add the next to the Podfile. – 0xRLA Nov 25 '16 at 13:54

2 Answers2

6

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

AsimRazaKhan
  • 2,154
  • 3
  • 22
  • 36
2

Actually the problem is when you write

pod 'GooglePlaces'

Inside the PodFile it's not bringing the right Pod but it still fetches the old GooglePlacesAPI Pod First just type pod search GooglePlaces inside terminal and it will fetch many results as the first one should be matched you will notice that it's gonna be THE OLD POD so .. You should update your pod repositories

pod update

And it takes time to finish even though you may not seeing any changes in the terminal but in Activity Monitor -> Network you can monitor it so Be patient until it finishes the update and after that just retype pod search GooglePlaces in terminal and it's gonna be the new one and then just run

pod install 

Again and you're good to go !

*Here is my Podfile in case you need to take a look :

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
Nour
  • 1,458
  • 1
  • 18
  • 27