2
votes

I'm trying to install 'Google/Analytics' inside my lib project in podspec.

My project lib was created using pod lib create with Swift.

This is my 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'

My 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

But when always run pod install I get this: target has transitive dependencies that include static binaries: (/Users/macpr/Documents/Projects/iOS/LibPSLogin/Example/Pods/Google/Libraries/libGGLAnalytics.a and /Users/macpr/Documents/Projects/iOS/LibPSLogin/Example/Pods/Google/Libraries/libGGLCore.a)

I already try to put this code inside my PodFile, but the Google Analytics can't be imported by .swift file.

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

As far as I know, the library project can't import static library. But what can I do to solve this problem? Can anyone help me?

Thanks

3
You might want to try GoogleReporter which is an open-source alternative that allows you to integrate Google Analytics in iOS 9+nathan

3 Answers

0
votes

As I know, this is impossible for such libraries. I faced the same issue several weeks ago.

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

2
votes

As you may know, since Cocoapods 1.5, and possibly 1.4, it has become possible to overcome the infamous transitive dependencies issue. My approach has been to use the static framework approach now possible that means you no longer need to use #use_frameworks! in the Podfile, but instead use use_modular_headers! More can be found in the blogpost introducing Cocoapods 1.5: http://blog.cocoapods.org/CocoaPods-1.5.0/

0
votes

You can take advantage of Carthage to install pure Swift framework like the repo I put it up: https://github.com/Lucashuang0802/CocoaPodsWithCarthage