【问题标题】:iOS Swift Library - target has transitive dependencies Google AnalyticsiOS Swift 库 - 目标具有传递依赖项 Google Analytics
【发布时间】:2017-12-27 21:44:17
【问题描述】:

我正在尝试在 podspec 中的 lib 项目中安装“Google/Analytics”。

我的项目库是使用 Swift 的 pod lib create 创建的。

这是我的 podspec:

s.source_files = 'Pod/类/**/*' s.resource_bundles = { 'LibPSLoginResources' => ['Pod/Resources/**/*.{xib,png,json}'] } s.dependency 'FBSDKCoreKit' s.dependency 'FBSDKLoginKit' s.dependency '谷歌/分析' s.dependency 'Firebase/Auth' s.dependency 'Firebase/Core' s.dependency 'Firebase/数据库'

我的 Pod 文件:

源'https://github.com/CocoaPods/Specs.git' 平台:ios,'8.0' 禁止所有警告! 使用_frameworks! 目标'LibPSLogin_Example'做 pod 'LibPSLogin', :path => '../' 目标'LibPSLogin_Tests'做 继承! :search_paths 结尾 结尾

但是当总是运行 pod install 我得到这个: 目标具有传递依赖项,包括静态二进制文件: (/Users/macpr/Documents/Projects/iOS/LibPSLogin/Example/Pods/Google/Libraries/libGGLAnalytics.a 和 /Users/macpr/Documents/Projects/iOS/LibPSLogin/Example/ Pods/Google/Libraries/libGGLCore.a)

我已经尝试将此代码放入我的 PodFile 中,但无法通过 .swift 文件导入 Google Analytics。

pre_install 做 |安装程序| def installer.verify_no_static_framework_transitive_dependencies;结尾 结尾

据我所知,库项目无法导入静态库。但是我能做些什么来解决这个问题呢? 谁能帮帮我?

谢谢

【问题讨论】:

  • 您可能想尝试GoogleReporter,它是一种开源替代方案,可让您在 iOS 9+ 中集成 Google Analytics(分析)

标签: ios swift google-analytics cocoapods firebase-analytics


【解决方案1】:

您可能知道,自从 Cocoapods 1.5 以及可能的 1.4 以来,克服臭名昭著的传递依赖问题已经成为可能。我的方法是现在可以使用静态框架方法,这意味着您不再需要使用#use_frameworks!在 Podfile 中,而是使用 use_modular_headers!更多内容可以在介绍 Cocoapods 1.5 的博文中找到:http://blog.cocoapods.org/CocoaPods-1.5.0/

【讨论】:

    【解决方案2】:

    据我所知,这样的库是不可能的。几周前我遇到了同样的问题。

    https://github.com/CocoaPods/CocoaPods/issues/6526

    【讨论】:

      【解决方案3】:

      您可以利用 Carthage 安装纯 Swift 框架,就像我提出的 repo 一样:https://github.com/Lucashuang0802/CocoaPodsWithCarthage

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-05-13
        相关资源
        最近更新 更多