【问题标题】:Google Maps Utilities IOS Pod errorGoogle Maps Utilities IOS Pod 错误
【发布时间】:2017-04-26 22:25:57
【问题描述】:

我在使用 pod 将 Google Maps IOS Utilities(用于标记聚类)添加到我的 swift xcode 项目时遇到问题。 当我运行 pod install 时,它失败并出现以下错误:

“Pods-App”目标具有传递依赖关系,包括静态 二进制文件: (/Users/warrick/Projects/orix/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)

Google 地图工作正常,但我一添加实用程序就崩溃了。

此错误消息是什么意思,我该如何解决?

这是我的 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

【问题讨论】:

    标签: ios swift google-maps google-maps-api-3


    【解决方案1】:

    由于 Cocoapods 的限制,这是一个没有现成解决方案的问题。当使用 Swift 构建应用程序时会出现限制,您在 podfile 中包含 use_frameworks!,并使用作为静态库提供的传递依赖项(例如 Google Maps)。

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

    此处描述了集成步骤:https://github.com/googlemaps/google-maps-ios-utils/blob/b721e95a500d0c9a4fd93738e83fc86c2a57ac89/Swift.md

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

    【讨论】:

    • 链接 (github.com/googlemaps/google-maps-ios-utils/blob/master/…) 不再存在。其他公司可以构建与 CocoaPods 一起安装的软件(甚至 GoogleMaps 也与 pod 一起安装)。
    • Ilya 提供的 Swift.md 中的说明是正确的,适用于 Xcode 11、Swift 5。
    • @Ilya Shvedikov 你在哪里添加了桥接头文件?
    【解决方案2】:

    我能够安装 pod,删除 use_frameworks 后错误消失了!来自 pod 文件,因为我们的项目在 swift 中,并在 podfile 中添加了以下行 pod 'GoogleMaps' # Objective-C pod pod 'Google-Maps-iOS-Utils', :git => 'https://github.com/googlemaps/google-maps-ios-utils'

    【讨论】:

    • 后来我遇到了问题,所以切换回手动集成,它工作了谢谢!!..stackoverflow.com/users/7261633/ilya-shvedikov
    • 感谢您的说明链接不再有效,因此您的步骤节省了很多时间
    • 很高兴听到愉快的编码:D
    猜你喜欢
    • 2016-07-02
    • 2021-01-12
    • 2016-08-02
    • 2015-07-05
    • 1970-01-01
    • 2016-10-26
    • 1970-01-01
    • 1970-01-01
    • 2016-09-16
    相关资源
    最近更新 更多