我在使用 pod 将 Google Maps IOS 实用程序(用于标记聚类)添加到我的 swift xcode 项目时遇到问题。
当我运行 pod install
时失败并出现以下错误:
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)
Google map 工作正常,但一旦我添加实用程序,它就会崩溃。
此错误消息是什么意思,我该如何解决?
这是我的 Pod 文件:
# 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
最佳答案
由于 Cocoapods 的限制,这个问题没有开箱即用的解决方案。在 Swift 中构建应用程序时会出现限制,您包括 use_frameworks!
在您的 podfile 中,并使用作为静态库提供的传递依赖项(例如 Google Maps
)。
因为 Google 不会提供动态框架(直到它支持 iOS 7),目前的解决方法是集成 Google Maps IOS Utilities
手动添加到您的项目中。
- Remove Google-Maps-iOS-Utils from the Podfile (if it is there). In your project create a group named
'Google-Maps-iOS-Utils'
.
- 将存储库下载到您的本地计算机。
- 通过右键单击
'Google-Maps-iOS-Utils'
将 src 目录中的文件夹添加到您的项目中组并选择“将文件添加到...”(确保选择目标作为您的应用程序目标,以避免出现 undefined symbol 问题)。 - 确保在 XCode 设置中为您的应用目标启用“使用 header 映射”(在 XCode 中默认启用)。
- 添加带有
#import "GMUMarkerClustering.h"
的桥接头文件(注意相对路径)。 - 打开伞头 GMUMarkerClustering.h(在 Google-Maps-iOS-Utils/Cluster 组下)并将所有导入路径更改为相对路径。例如,更改
#import <Google-Maps-iOS-Utils/GMUCluster.h>
至#import "GMUCluster.h"
. (“使用标题映射”设置将正确解析相对路径)。 - 构建您的项目。
- 就是这样。
关于ios - Google map 实用程序 IOS Pod 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41094343/