Подтвердить что ты не робот

Использование API Google Адресов с Alamofire 4.0 и iOS 10 и Swift 3

Мой проект в настоящее время построен в Xcode 8 и в Swift 3 с Alamofire 4.0. Я использую CocoaPods для реализации Alamofire.

Мой подкайл выглядит следующим образом:

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

Google работает с предыдущими версиями Alamofire (3.4.0), но я не могу заставить его работать с 4.0.0+. Я делаю что-то неправильно здесь? кто-нибудь еще имеет ту же проблему/нашел исправление?

UPDATE: Мне все еще не повезло после установки чистой стручки

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.
4b9b3361

Ответ 1

Вы должны изменить версию Google Places на 2. * в вашем файле подкачки, для этой зависимости требуется Alamofire 4.0.

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

Ответ 2

На самом деле проблема заключается в том, что вы пишете

pod 'GooglePlaces'

Внутри PodFile он не приносит правильный Pod, но он по-прежнему выбирает old GooglePlacesAPI Pod Первый только тип pod search GooglePlaces внутри терминала, и он будет извлекать множество результатов, поскольку первый должен быть сопоставлен, вы заметите, что он будет THE OLD POD, поэтому.. Вы должны обновить свои хранилища pod

pod update

И вам нужно время, чтобы закончить, даже если вы не видите никаких изменений в терминале, но в Activity Monitor → Network вы можете контролировать его, так что будьте терпеливы, пока не завершит обновление, и после этого просто повторно введите pod search GooglePlaces в терминале и он будет новым, а затем просто запустите

pod install 

Снова, и вам хорошо идти!

* Вот мой Подфайл в случае, если вам нужно взглянуть:

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