2016-11-07 29 views
10

Dự án của tôi hiện được xây dựng trong Xcode 8 và trong Swift 3 với Alamofire 4.0. Tôi sử dụng CocoaPods để triển khai Alamofire.Sử dụng API Google Địa điểm với Alamofire 4.0 và iOS 10 và Swift 3

podfile của tôi là như sau:

# 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   

tôi nhận được lỗi sau đây trong các thiết bị đầu cuối khi cố gắng cài đặt 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)` 

nơi Google làm việc với các phiên bản trước của Alamofire (3.4 .0) nhưng tôi không thể làm cho nó làm việc với 4.0.0 +. Tôi có làm gì sai ở đây? có ai khác có cùng vấn đề/tìm thấy bản sửa lỗi không?

UPDATE: tôi đã vẫn không có may mắn sau pod sạch cài đặt

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

Tôi không nhìn thấy kết quả tương tự sao chép podfile của bạn vào một dự án mới, và GooglePlaces 2.1.0 được cài đặt một cách an toàn. Có thể thử cài đặt vỏ sạch? 'rm -Rf Pods; pod install' – emb

+1

không hoạt động. tôi vừa tạo ra một dự án mới và cố gắng như vậy nhưng vẫn gặp lỗi tương tự. nó có thể là phiên bản cocoapod của tôi không? im chạy cocoapods 1.1.1 trên El Capitan 10.11.5 –

+1

Rất lạ. Tôi đã có một thiết lập rất giống với cocoapods 1.1.1 và El Capitan 10.11.6. Có thể bạn có thể đăng tất cả mọi thứ cocoapods in vào Terminal sau khi bạn 'rm -Rf Pods; pod install'? Tò mò để xem nó được bao xa trước khi nó hoạt động sai. – emb

Trả lời

2

Trên thực tế vấn đề là khi bạn viết

pod 'GooglePlaces' 

Bên trong PodFile nó không mang lại quyền Pod nhưng nó vẫn fetches old GooglePlacesAPI Pod Đầu tiên chỉ cần gõ pod search GooglePlaces bên trong thiết bị đầu cuối và nó sẽ lấy nhiều kết quả như là một trong những đầu tiên nên được xuất hiện, bạn sẽ nhận thấy rằng nó sẽ là THE OLD POD vì vậy .. Bạn nên cập nhật y kho pod của chúng tôi

pod update 

Và phải mất thời gian để kết thúc mặc dù bạn có thể không nhìn thấy bất kỳ thay đổi trong thiết bị đầu cuối nhưng trong Activity Monitor -> Network, bạn có thể theo dõi nó để Hãy kiên nhẫn cho đến khi nó kết thúc cập nhật và sau đó chỉ gõ lại tìm kiếm pod GooglePlaces trong terminal và nó sẽ là một cái mới và sau đó chỉ cần chạy

pod install 

Một lần nữa và bạn tốt để đi!

* Đây là Podfile tôi trong trường hợp bạn cần phải có một cái nhìn:

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 
Các vấn đề liên quan