2016-12-12 150 views
1

我無法添加谷歌地圖IOS實用程序(標記集羣)到我的swift xcode項目與豆莢。 當我運行pod install失敗,出現以下錯誤:谷歌地圖工具IOS Pod錯誤

The 'Pods-App' target has transitive dependencies that include static binaries: (/Users/warrick/Projects/orix/App/Pods/GoogleMaps/Subspecs/Base/Frameworks/GoogleMapsBase.framework, /Users/warrick/Projects/orix/App/Pods/GoogleMaps/Subspecs/Maps/Frameworks/GoogleMapsCore.framework, and /Users/warrick/Projects/orix/App/Pods/GoogleMaps/Subspecs/Maps/Frameworks/GoogleMaps.framework)

谷歌地圖工作正常,但只要我添加它打破了公用事業。

這個錯誤信息是什麼意思,我該如何解決它?

這裏是我的Podfile:

# Uncomment the next line to define a global platform for your project 
# platform :ios, '9.0' 
workspace '../app' 

target 'App' do 
    # Comment the next line if you're not using Swift and don't want to use dynamic frameworks 
    use_frameworks! 

    pod 'GoogleMaps' 
    pod 'Google-Maps-iOS-Utils' 

    # Firebase - used for notifications 
    pod 'Firebase/Core' 
    pod 'Firebase/Messaging' 

    target 'AppTests' do 
    inherit! :search_paths 
    # Pods for testing 
    end 

end 

回答

9

這是不具有開箱即用的解決方案由於的CocoaPods限制的問題。當在Swift中構建應用程序時,會發生此限制,您的pod文件中包含use_frameworks!,並且正在使用作爲靜態庫(如Google Maps)提供的傳遞依賴項。

由於Google不會提供動態框架(直到它支持iOS 7),目前的解決方法是將Google Maps IOS Utilities手動集成到您的項目中。這裏介紹

的整合步驟:https://github.com/googlemaps/google-maps-ios-utils/blob/master/Swift.md

  • Remove Google-Maps-iOS-Utils from the Podfile (if it is there). In your project create a group named 'Google-Maps-iOS-Utils' .
  • Download the repo into your local computer.
  • Add the folders inside the src directory into your project by right clicking on the 'Google-Maps-iOS-Utils' group and selecting "Add Files to ..." (Make sure you select the target as your app target to avoid undefined symbols issue).
  • Make sure "Use Header Map" is ON for your app target in XCode Settings (it is ON by default in XCode).
  • Add a bridging header file with #import "GMUMarkerClustering.h" (note the relative path).
  • Open the umbrella header GMUMarkerClustering.h (under the Google-Maps-iOS-Utils/Cluster group) and change all the import paths to relative. For example, change #import <Google-Maps-iOS-Utils/GMUCluster.h> to #import "GMUCluster.h" . (The 'Use Header Map' setting will resolve the relative path correctly).
  • Build your project.
  • That's it.