首页 文章

iOS Swift Library - 目标具有传递依赖性Google Analytics

提问于
浏览
2

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

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

这是我的podspec:

s.source_files = 'Pod/Classes/**/*'

      s.resource_bundles = {
        'LibPSLoginResources' => ['Pod/Resources/**/*.{xib,png,json}']
      }

      s.dependency 'FBSDKCoreKit'
      s.dependency 'FBSDKLoginKit'
      s.dependency 'Google/Analytics'
      s.dependency 'Firebase/Auth'
      s.dependency 'Firebase/Core'
      s.dependency 'Firebase/Database'

我的PodFile:

source 'https://github.com/CocoaPods/Specs.git'

    platform :ios, '8.0'
    inhibit_all_warnings!
    use_frameworks!

    target 'LibPSLogin_Example' do
      pod 'LibPSLogin', :path => '../'

      target 'LibPSLogin_Tests' do
        inherit! :search_paths

      end
    end

但是当总是运行pod install我得到这个:target具有包含静态二进制文件的传递依赖:(/ Users / macpr / Files / Project / iOS / LibsLogin / Example /Pods / Google / Library / libGGLAnalytics.a和/ Users / macpr /Documents/Projects/iOS/LibPSLogin/Example/Pods/Google/Libraries/libGGLCore.a)

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

pre_install do |installer|
        def installer.verify_no_static_framework_transitive_dependencies; end
    end

据我所知,库项目无法导入静态库 . 但是我该怎么做才能解决这个问题呢?谁能帮我?

谢谢

3 回答

  • 0

    据我所知,这对于这些图书馆来说是不可能的 . 几周前我遇到了同样的问题 .

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

  • 0

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

  • 0

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

相关问题