我的项目目前是在 Xcode 8 和带有 Alamofire 4.0 的 Swift 3 中构建的。我使用 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 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 可以与以前版本的 Alamofire (3.4.0) 一起使用,但我无法让它与 4.0.0+ 一起使用。我在这里做错了什么吗?还有其他人遇到同样的问题/找到解决办法了吗?
更新: 干净的 pod 安装后我仍然没有运气
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.
最佳答案
您应该在 pod 文件中将 Google Places
的版本更改为 2.*,此依赖项需要 Alamofire 4.0
。
Google Places pod v2.* : https://cocoapods.org/?q=googleplaces
关于ios - 在 Alamofire 4.0、iOS 10 和 Swift 3 中使用 Google Places API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40473464/