Cocoapods: "The Podfile contains framework or static library targets, for which the Podfile does not contain host targets"

Created on 15 Oct 2017  路  17Comments  路  Source: CocoaPods/CocoaPods

Report

I am getting the following error:
_[!] The Podfile contains framework or static library targets, for which the Podfile does not contain host targets (targets which embed the framework).
If this project is for doing framework development, you can ignore this message. Otherwise, add a target to the Podfile that embeds these frameworks to make this message go away (e.g. a test target)._

Some comments:

  • all targets in Podfile are apps except "Infra" which is a static library.
  • All targets, including Infra, are using Dropbox SDK and therefore must be installed with Dropbox pods
  • Infra is an embedded subproject (of static library type) in each App project (i.e. Infra project is embedded in BookApp project)
  • I had no issues with this podfile while using cocoapods 1.1.1
  • When I remove the Infra target from the Podfile (as following listed), the above cocoapods error is gone however the Infra project will obviously fail to compile in Xcode.
target 'Infra' do
  project 'Infra/Infra'
    pod 'ObjectiveDropboxOfficial'
end

What did you do?

Run pod install

What did you expect to happen?

Install all pod dependencies correctly.

What happened instead?

Error appeared as described above.

CocoaPods Environment

CocoaPods : 1.3.1
Ruby : ruby 2.3.3p222 (2016-11-21 revision 56859) [universal.x86_64-darwin17]
RubyGems : 2.5.2
Host : Mac OS X 10.13 (17A405)
Xcode : 9.0 (9A235)
Git : git version 2.13.5 (Apple Git-94)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ 26d68903bc6ced65547ef95bac7114cb5178d289

platform :ios, '9.0'
 workspace 'My Apps'

target 'BookApp' do
  project 'BookApp/BookApp'
    pod 'ObjectiveDropboxOfficial'
end

target 'BookApp Pro' do
  project 'BookApp/BookApp'
    pod 'ObjectiveDropboxOfficial'
end

target 'MovieApp' do
  project 'MovieApp/MovieApp'
    pod 'ObjectiveDropboxOfficial'
end

target 'MovieApp Pro' do
  project 'MovieApp/MovieApp'
    pod 'ObjectiveDropboxOfficial'
end

target 'MusicApp' do
  project 'MusicApp/MusicApp'
    pod 'ObjectiveDropboxOfficial'
end

target 'MusicApp Pro' do
  project 'MusicApp/MusicApp'
    pod 'ObjectiveDropboxOfficial'
end

target 'Infra' do
  project 'Infra/Infra'
    pod 'ObjectiveDropboxOfficial'
end
easy enhancement

Most helpful comment

Is there a way to silence this warning? It is showing up incorrectly for me. I have an xcode project file in my workspace that builds an internal framework that is not under pod control and it is embedded normally via Xcode's embed frameworks phase. I use Cocoapods to manage dependency of this internal framework's dependency, so it is giving me this warning about a framework target not being embedded.

I am not sure what this warning is supposed to tell me, or honestly how it would ever give actionable, correct information. The suggestion it gives, to embed it within some other target in the Podfile, does not seem like the thing I actually want to do. The warning doesn't even tell you which target it is complaining about.

All 17 comments

This is not an error, rather a warning. You did not see this prior to latest upgrade because this warning did not exist in a previous version.

Having targets in the podfile that are static libraries or dynamic frameworks is probably fine but CocoaPods is just warning you that these targets are not embedded within other targets and they are supposed to.

This is a friendly warning and while slightly annoying I don't think there is anything for us to do here.

Compilation should continue to work just fine for you @yoasha

@dnkoutso thank you for your reply. Is there any way to "tell" CocoaPods that either 'BookApp', 'MovieApp', or 'MusicApp' are the host target of the 'Infra' static library target? I guess there is a way to do that in order to prevent the warning.

Is there a way to silence this warning? It is showing up incorrectly for me. I have an xcode project file in my workspace that builds an internal framework that is not under pod control and it is embedded normally via Xcode's embed frameworks phase. I use Cocoapods to manage dependency of this internal framework's dependency, so it is giving me this warning about a framework target not being embedded.

I am not sure what this warning is supposed to tell me, or honestly how it would ever give actionable, correct information. The suggestion it gives, to embed it within some other target in the Podfile, does not seem like the thing I actually want to do. The warning doesn't even tell you which target it is complaining about.

+1 for @bdorfman s comment, would be nice to be able to silence it! :)

The warning is extremely annoying.

Suggestions for ways to make it less annoying would be welcome

I agree with @bdorfman, embedding the framework in another target that IS on the Podfile when I'm not actually going to use it there doesn't seem like a great fix.

Is it possible to flag the framework in the Podfile as internal? If it was explicitly declared as such it would make sense when the warning disappeared.

This can be silenced by adding an installation option.

Are you referencing install!? Which option would silence? I noticed the integrate_targets which sounds along the same lines but I haven't looked into the details of the available options for this spec.

install! 'cocoapods',
         :integrate_targets => false

yes there is also another one for multiple pod sources support here https://github.com/CocoaPods/CocoaPods/blob/master/lib/cocoapods/installer/installation_options.rb#L109

Should be fairly easy to implement. Keep in mind if it goes there it will be a global option, i.e you cannot customize it per target. For per target customization it will need a DSL added to the Core.

The integrate_targets => false option silenced the warning for me! It also silenced everything else though.

Unfortunately, the warn_for_multiple_pod_sources => false option didn't silence the relevant warning warning for me. Do I have it right?

install! 'cocoapods',
         :warn_for_multiple_pod_sources => false

I prefer this solution as it is cleaner and makes more sense, if it worked. It has a very descriptive name specifically for this case and I've definitely run into this warning before and just hadn't bothered to look into how to silence it effectively. Thank you for your help on this!

@bornbrie you may have misunderstood me. There is no option today and integrate_targets is a completely different option that only downloads dependencnies.

warn_for_multiple_pod_sources is also different.

What I am saying is we need to add a new one that can be configured by folks to disable this warning.

Oh perfect, no wonder it wasn't working haha. At least it's not broken! Silly me. @dnkoutso Thank you for clarifying Sorry!

I'd also like to note that the message itself makes little sense for a static library target. It doesn't need a host target which embeds the library since it's static, linking is enough.

Sorry to bust this one open again, but I receive this warning when defining an abstract_target as well.

The warning tells me that the 'abstact target' is the culprit, but I can't really add that target to any of _my_ targets...feels like the chicken and egg problem here.

Unless I missed something this errant warning still exists for static libraries, no embedding makes sense for those since they are compiled into targets using it...?

This is work for me.

target 'BookApp' do
  project 'BookApp/BookApp'
    pod 'ObjectiveDropboxOfficial'

    ///// Add the test targets to remove the warning.
    target 'BookAppTests' do
    end

end
Was this page helpful?
0 / 5 - 0 ratings