Cocoapods: Cocoapods dependency issue

Created on 8 Aug 2015  ·  23Comments  ·  Source: CocoaPods/CocoaPods

I am trying to create a Cocoapods library. My library will include Google-Mobile-Ads-SDK as dependency. I used following commands

pod lib create BannerViewController
 > my email address
What language do you want to use?? [ ObjC / Swift ]
 > Swift
Would you like to include a demo application with your library? [ Yes / No ]
 > Yes
Which testing frameworks will you use? [ Quick / None ]
 > None
Would you like to do view based testing? [ Yes / No ]
 > No  

then edited BannerViewController.podspec added following line

s.dependency 'Google-Mobile-Ads-SDK', '~> 7.0'

I tried to use pod lib lint BannerViewController.podspec

[!] BannerViewController did not pass validation, due to 1 error and 3 warnings.
You can use the `--no-clean` option to inspect any issue.

I tried to pod update in Example directory and got following error

[!] The 'Pods-BannerViewController_Example' target has transitive dependencies that include static binaries: (/Developer/BannerViewController/Example/Pods/Google-Mobile-Ads-SDK/GoogleMobileAdsSdkiOS-7.4.0/GoogleMobileAds.framework)

I don't know how can I add Google-Mobile-Ads-SDK to my development pod so that I can test my code locally. Cocoapods documentation is not clear. I am using Cocoapods 0.38.2

Most helpful comment

Don't use use_frameworks! in your Podfile, and lint using the ---use-libraries flag.

All 23 comments

You have to integrate as a static library until google ships a dynamic framework for their pod.

Could you share the details of this process? I asked on SO as well but I didn't get any reply. I will really appreciate if you can direct me to web page that details how to include Google-Moblie-Ads-SDK. For example Google ads can be integrated easily by pod and using objc header file. Isn't there a way to integrate ad sdk to my developer project same way so that I can work on it test it and publish? I know this is not a support forum but as I said I am run out of options.

Don't use use_frameworks! in your Podfile, and lint using the ---use-libraries flag.

Sorry for opening this issue again. I just gave it a go today again. Still it doesn't work. I removed use_frameworks! and tried to lint it with pod lib lint --use-libraries I get again the samer error message Here are my files

BannerViewController.podspec

Pod::Spec.new do |s|
  s.name             = "BannerViewController"
  s.version          = "0.1.0"
  s.summary          = "A short description of BannerViewController."

# This description is used to generate tags and improve search results.
#   * Think: What does it do? Why did you write it? What is the focus?
#   * Try to keep it short, snappy and to the point.
#   * Write the description between the DESC delimiters below.
#   * Finally, don't worry about the indent, CocoaPods strips it!  
  s.description      = <<-DESC
                          Some long description
                       DESC

  s.homepage         = "https://github.com/tosbaha/BannerViewController"
  # s.screenshots     = "www.example.com/screenshots_1", "www.example.com/screenshots_2"
  s.license          = 'MIT'
  s.author           = { "tosbaha" => "[email protected]" }
  s.source           = { :git => "https://github.com/tosbaha/BannerViewController.git", :tag => s.version.to_s }
  # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'

  s.platform     = :ios, '7.0'
  s.requires_arc = true

  s.source_files = 'Pod/Classes/**/*'
  s.resource_bundles = {
    'BannerViewController' => ['Pod/Assets/*.png']
  }
  s.dependency 'Google-Mobile-Ads-SDK', '~> 7.0'
end

Podfile

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

target 'BannerViewController_Example', :exclusive => true do
  pod "BannerViewController", :path => "../"
end

target 'BannerViewController_Tests', :exclusive => true do
  pod "BannerViewController", :path => "../"


end

Can you please share the output of pod lib lint --use-libraries --verbose? Thanks!

Here is the output

    BannerViewController (0.1.0) - Analyzing on iOS 7.0 platform.
  Preparing

Analyzing dependencies

Fetching external sources
-> Fetching podspec for `BannerViewController` from `/Developer/BannerViewController/BannerViewController`

Resolving dependencies of 

Comparing resolved specification to the sandbox manifest
  A BannerViewController
  A Google-Mobile-Ads-SDK

Downloading dependencies

-> Installing BannerViewController (0.1.0)

-> Installing Google-Mobile-Ads-SDK (7.4.1)
  > Copying Google-Mobile-Ads-SDK from
  `/Users/mustafa/Library/Caches/CocoaPods/Pods/Release/Google-Mobile-Ads-SDK/7.4.1-dce4c` to
  `../../../private/var/folders/l6/kbswrgr55vb7pj79r5t1_s5m0000gn/T/CocoaPods/Lint/Pods/Google-Mobile-Ads-SDK`
  - Running pre install hooks
 -> BannerViewController (0.1.0)
    - WARN  | summary: The summary is not meaningful.
    - WARN  | description: The description is shorter than the summary.
    - WARN  | url: There was a problem validating the URL https://github.com/<GITHUB_USERNAME>/BannerViewController.
    - ERROR | [iOS] unknown: Encountered an unknown error (Pods written in Swift can only be integrated as frameworks; add `use_frameworks!` to your Podfile or target to opt into using it. The Swift Pod being used is: BannerViewController) during validation.

[!] BannerViewController did not pass validation, due to 1 error and 3 warnings.
You can use the `--no-clean` option to inspect any issue.

/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0.beta.3/lib/cocoapods/command/lib.rb:181:in `block in run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0.beta.3/lib/cocoapods/command/lib.rb:153:in `each'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0.beta.3/lib/cocoapods/command/lib.rb:153:in `run'
/Library/Ruby/Gems/2.0.0/gems/claide-0.9.1/lib/claide/command.rb:312:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0.beta.3/lib/cocoapods/command.rb:48:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0.beta.3/bin/pod:44:in `<top (required)>'
/usr/bin/pod:23:in `load'
/usr/bin/pod:23:in `<main>'
- ERROR | [iOS] unknown: Encountered an unknown error (Pods written in Swift can only be integrated as frameworks; add `use_frameworks!` to your Podfile or target to opt into using it. The Swift Pod being used is: BannerViewController) during validation.

You said don't use use_frameworks! That is why I removed it from Podfile. I am really puzzled. So it means there is no way to use cocoapods to integrate Google-Mobile-Ads-SDK to my swift library?

Ask Google to update to ship dynamic frameworks ¯_(ツ)_/¯

Do we have a solution for this problem? So, we can't use a static library as a dependency to develop framework?

No, this is a LLVM / iOS issue, not a CocoaPods one.

I'm following. I have the same issue with Google SignIn iOS library. This is the error from pod spec lint:

- ERROR | [iOS] unknown: Encountered an unknown error (The 'Pods' target has transitive dependencies that include static binaries: (/private/var/folders/1_/7bxg_52x3rg89wmdqy6fnkrc0000gn/T/CocoaPods/Lint/Pods/Google/Libraries/libGGLCore.a and /private/var/folders/1_/7bxg_52x3rg89wmdqy6fnkrc0000gn/T/CocoaPods/Lint/Pods/Google/Libraries/libGGLSignIn.a)) during validation.

I have the same problem :(

@kunalbalani use --use-libraries when you validate or submit to CocoaPods. And if you do it this way, you users can use use_frameworks! in Podfile.

@Lucashuang0802 that worked. Thanks 👍

Hi, same issue. use use_frameworks! in your Podfile, do not use --use-libraries when lint.

Hey,

I have the same issue,

    - ERROR | [iOS] unknown: Encountered an unknown error (The 'Pods-App' target has transitive dependencies that include static binaries: (/private/var/folders/57/pv4_gcjx5pn3_0vht648bqsm0000gn/T/CocoaPods/Lint/Pods/GoogleAds-IMA-iOS-SDK/GoogleInteractiveMediaAds/GoogleInteractiveMediaAds-GoogleIMA3/GoogleInteractiveMediaAds.framework)) during validation.

tried --use-libraries it doesn't help.

can you give me a solution? for now below is my code from podspec:

s.subspec 'IMAPlugin' do |ssp|
    ssp.source_files = 'Plugins/IMA'
    ssp.xcconfig = { 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES',
                  'OTHER_LDFLAGS' => '$(inherited) -framework "GoogleInteractiveMediaAds"',
                  'FRAMEWORK_SEARCH_PATHS' => '$(inherited) "${PODS_ROOT}"/**',
                  'LIBRARY_SEARCH_PATHS' => '$(inherited) "${PODS_ROOT}"/**' }
    ssp.dependency 'GoogleAds-IMA-iOS-SDK', '~> 3.3'
end

Pod install works but lint doesnt work for me, how can i handle it?

Thanks!

to:
@tosbaha , @segiddins , @orta , @Lucashuang0802 , @nicorsm

Hi. Is there any workaround for this issue? It has been more than one year and I'm wondering if there is something else people haven't tried yet.

The CocoaPods static_framework introduced in 1.4.0 enables pods to depend on static library framework CocoaPods like Google-Mobile-Ads-SDK.

if these method still solve your problem ,try to clean your local CocoaPods cache(remove file xx/Library/Caches/CocoaPods/Pods)

In the .podspec file, above the line:
s.dependency ...
Add:
s.static_framework = true

when using CocoaPods version 1.4.0 and above and everything should work fine!

Hi, adding s.static_framework = true worked for me. But can someone explain how that works, not clear on what that flag does. Thank you

@ravika08 See the Static Frameworks section in the CocoaPods 1.4.0 announcement blog.

Was this page helpful?
0 / 5 - 0 ratings