Google Maps Utilities IOS Pod错误

War*_*ick 3 google-maps google-maps-api-3 ios swift

我无法将Google Maps IOS Utilities(用于标记群集)添加到我的带有pod的swift xcode项目中.当我运行pod install它失败时出现以下错误:

'Pods-App'目标具有包含静态二进制文件的传递依赖项:(/ Users/warrick/Project/index/App/Pods/GoogleMaps/Subspecs/Base/Frameworks/GoogleMapsBase.framework,/ Users/warrick/Projects/orix/App/Pods/GoogleMaps/Subspecs/Maps/Frameworks/GoogleMapsCore.framework,和/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
Run Code Online (Sandbox Code Playgroud)

小智 13

由于Cocoapods的限制,这个问题没有开箱即用的解决方案.当应用程序在Swift中构建时,您将包含use_frameworks!在podfile中,并且正在使用作为静态库(例如Google Maps)提供的传递依赖性.

因为Google不会提供动态框架(直到它支持iOS 7),目前的解决方法是Google Maps IOS Utilities手动集成到您的项目中.

此处介绍了集成步骤:https://github.com/googlemaps/google-maps-ios-utils/blob/master/Swift.md

  • 从Podfile中删除Google-Maps-iOS-Utils(如果有的话).在您的项目中创建一个名为的组'Google-Maps-iOS-Utils'.
  • 将repo下载到本地计算机.
  • 通过右键单击该'Google-Maps-iOS-Utils'组并选择"将文件添加到...",将src目录中的文件夹添加到项目中(确保选择目标作为应用目标,以避免未定义的符号问题).
  • 确保在XCode设置中为您的应用目标启用"使用标题映射"(默认情况下,它在XCode中为ON).
  • 添加桥接头文件#import "GMUMarkerClustering.h"(注意相对路径).
  • 打开伞标题GMUMarkerClustering.h(在Google-Maps-iOS-Utils/Cluster组下)并将所有导入路径更改为relative.例如,更改#import <Google-Maps-iOS-Utils/GMUCluster.h>#import "GMUCluster.h".("使用标题映射"设置将正确解析相对路径).
  • 建立你的项目.
  • 而已.