Run pod install
to install dependencies on a project StaticLib containing a single Cocoa Touch Static Library target.
Install all pod dependencies correctly.
Note that if I had a project containing a single Cocoa Touch Dynamic Framework target, pod install
would just log a warning about missing host target instead of failing.
I think that the same should happen for static library targets.
Installation fails with the following error message:
[!] Unable to find host target(s) for StaticLib. Please add the host targets for the embedded targets to the Podfile.
Certain kinds of targets require a host target. A host target is a "parent" target which embeds a "child" target. These are example types of targets that need a host target:
- Framework
- App Extension
- Watch OS 1 Extension
- Messages Extension (except when used with a Messages Application)
CocoaPods : 1.2.1
Ruby : ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
RubyGems : 2.0.14.1
Host : Mac OS X 10.12.4 (16E195)
Xcode : 8.3.1 (8E1000a)
Git : git version 2.11.0 (Apple Git-81)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib
master - https://github.com/CocoaPods/Specs.git @ a91d4fe9993eea485f42845382746218dcaf38a9
Executable Path: /usr/local/bin/pod
cocoapods-art : 1.0.0
cocoapods-deintegrate : 1.0.1
cocoapods-dependencies : 1.0.0
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.0.0
cocoapods-trunk : 1.2.0
cocoapods-try : 1.1.0
slather : 2.3.0
platform :ios, 10
target 'StaticLib'
pod 'AFNetworking'
project 'StaticLib/StaticLib.xcodeproj'
See project at https://bitbucket.org/mirkoluchi/cocoapods-issues (folder issue-6673)
Having this same issue using CocoaPods v1.2.1
. Temporary fix for me was downgrading to v1.0.1
.
Erg. Yep I think I forgot one piece of the static lib puzzle when I was working on support for this. Will fix. I was recently on vacation, so I'm still catching up on issues and things while I was out. I'll try to get a fix up shortly (next week or so). Thanks for the report!
Posting this here since I'd rather not create another issue & I believe this is related.
I'm currently getting this issue & had a rough time trying to figure.
Working with this example project:
https://github.com/benasher44/CocoaPodsLibExample
To reproduce, remove the subproject "SampleStaticLib.xcodeproj" from the "SampleApp" project whilst maintaining it added within the workspace:
Then run pod install
. The output will be as follows:
[!] Unable to find host target(s) for SampleStaticLib. Please add the host targets for the embedded targets to the Podfile.
Certain kinds of targets require a host target. A host target is a "parent" target which embeds a "child" target. These are example types of targets that need a host target:
- Framework
- App Extension
- Watch OS 1 Extension
- Messages Extension (except when used with a Messages Application)
Which does not provide an adequate explanation as to what's wrong.
I might add that prior to 1.2.1
I was able to install pods against both targets fine without having to add the project as subproject within "SampleApp" and to Target Dependencies.
Encountered the same issue here, it seems that it happens in version 1.2.x only, I've used the following command to resolve it temporarily.
pod _1.1.1_ install
It didn't happen for me in version 1.1.1.
Same here, static lib target/project in a workspace that also contains a framework target (uses same source files but not cocoapods). Downgrading to 1.2.0 fixed the issue so bug is in 1.2.1 not 1.2.x as mentioned earlier.
Fix is up. I'd appreciate if someone could verify the fix here: #6721. Thanks!
The fix is now on CocoaPods master and should be available in the next release. I'd appreciate though if someone could try using CocoaPods master and give a 馃憤 :)
What's is the solution to make it work with CocoaPods 1.2.1. I have another Pod dependency to React that requires 1.2.0 at least.
I tested the fix but, unless I didn't correctly install the gem from the master branch, the fix is not working.
I did this:
VERSION = '1.2.2'.freeze unless defined? Pod::VERSION
s.add_runtime_dependency 'cocoapods-core', "= 1.2.1"
gem build cocoapods.gemspec
sudo gem install cocoapods-1.2.2.gem
Launching聽pod install
on the sample project at https://bitbucket.org/mirkoluchi/cocoapods-issues (folder issue-6673) gives the the same error for which this issue was opened:
[!] Unable to find host target(s) for StaticLib. Please add the host targets for the embedded targets to the Podfile.
Certain kinds of targets require a host target. A host target is a "parent" target which embeds a "child" target. These are example types of targets that need a host target:
- Framework
- App Extension
- Watch OS 1 Extension
- Messages Extension (except when used with a Messages Application)
Here my environment:
### Stack
CocoaPods : 1.2.2
Ruby : ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
RubyGems : 2.0.14.1
Host : Mac OS X 10.12.5 (16F73)
Xcode : 8.3.2 (8E2002)
Git : git version 2.11.0 (Apple Git-81)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib
Repositories :
master - https://github.com/CocoaPods/Specs.git @ c28100e5298731e0aa8bf93dd4f0d06bc428b454
### Installation Source
Executable Path: /usr/local/bin/pod
### Plugins
cocoapods-deintegrate : 1.0.1
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.0.0
cocoapods-trunk : 1.2.0
cocoapods-try : 1.1.0
slather : 2.3.0
### Podfile
```ruby
platform :ios, 10
target 'StaticLib'
pod 'AFNetworking'
project 'StaticLib/StaticLib.xcodeproj'
```
Can confirm 1.3.0.beta.1
has fixed this for me.
sudo gem install -n /usr/local/bin cocoapods --pre
update cocoapods version over 1.2.1! has fixed this problem.
Most helpful comment
Encountered the same issue here, it seems that it happens in version 1.2.x only, I've used the following command to resolve it temporarily.
pod _1.1.1_ install
It didn't happen for me in version 1.1.1.