Cocoapods: Documentation for host targets in podfile

Created on 10 Apr 2017  Â·  4Comments  Â·  Source: CocoaPods/CocoaPods

Before you start, are you using the latest CocoaPods release?

Yes, tried both 1.2.0 and 1.2.1.rc.1

A lot changes with Xcode releases that are not backwards compatible.

Not an issue about the CocoaPods command line app? Please file an issue in the appropriate repo - https://github.com/CocoaPods
Issues are for feature requests, and bugs; questions should go to Stack Overflow

Using CocoaPods <= 0.39: http://blog.cocoapods.org/Sharding/

Using Xcode 8: Requires CocoaPods 1.1.0 or above.

Issue with Nanaimo not loading:
Please run [sudo] gem uninstall nanaimo and remove all but the latest version.

Issues with pod search? Try deleting your cache rm -rf ~/Library/Caches/CocoaPodsfirst.

Report

What did you do?

We have an app with a Share Extension that we would like to be able to have access to some of the same libraries in the main app via the podfile/cocoapods, but cannot figure out how to put it in the podfile, everything gives an error.

ℹ Please replace this with what you did.
pod update

What did you expect to happen?

ℹ Please replace this with what you expected to happen.
install all pod dependencies properly for the main target and the share extension target

What happened instead?

ℹ Please replace this with of what happened instead.

Received this error

ruby-2.4.1 [17:15][joel@Junior:Source(master)]$ pod update
Update all pods
Updating local specs repositories

CocoaPods 1.2.1.rc.1 is available.
To update use: `gem install cocoapods --pre`
[!] This is a test version we'd love you to try.

For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.2.1.rc.1

Analyzing dependencies
Pre-downloading: `ChameleonFramework` from `https://github.com/ViccAlexander/Chameleon.git`
Pre-downloading: `Eureka` from `https://github.com/xmartlabs/Eureka.git`
Pre-downloading: `SVProgressHUD` from `https://github.com/SVProgressHUD/SVProgressHUD.git`
Pre-downloading: `SentrySwift` from `https://github.com/getsentry/sentry-swift.git`, tag `1.3.2`
[!] Unable to find host target(s) for ShareExtension. 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)

or this if I try to put that share extension target in the shout extension

Update all pods
Updating local specs repositories

CocoaPods 1.2.1.rc.1 is available.
To update use: `gem install cocoapods --pre`
[!] This is a test version we'd love you to try.

For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.2.1.rc.1

Analyzing dependencies
Pre-downloading: `ChameleonFramework` from `https://github.com/ViccAlexander/Chameleon.git`
Pre-downloading: `Eureka` from `https://github.com/xmartlabs/Eureka.git`
Pre-downloading: `SVProgressHUD` from `https://github.com/SVProgressHUD/SVProgressHUD.git`
Pre-downloading: `SentrySwift` from `https://github.com/getsentry/sentry-swift.git`, tag `1.3.2`
[!] Unable to find host target(s) for Shout-ShareExtension. 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 Environment

ℹ Please replace this with the output of pod env.

### Stack

CocoaPods : 1.2.0
Ruby : ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
RubyGems : 2.6.11
Host : Mac OS X 10.12.4 (16E195)
Xcode : 8.2.1 (8C1002)
Git : git version 2.7.3
Ruby lib dir : /Users/joel/.rvm/rubies/ruby-2.4.1/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ 80b5c67c9c38c4796b84549916c77aaac4efbaeb

### Installation Source

Executable Path: /Users/joel/.rvm/gems/ruby-2.4.1/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.1.2
cocoapods-try : 1.1.0

### Podfile

```ruby
project 'Shout.xcodeproj'

target 'Shout' do
  use_frameworks!

  # Pods for Shout
  #pod 'FBSDKCoreKit'
  #pod 'FBSDKLoginKit'
  pod 'ChameleonFramework/Swift', :git => 'https://github.com/ViccAlexander/Chameleon.git'
  pod 'Eureka', :git => 'https://github.com/xmartlabs/Eureka.git'
  pod 'SVProgressHUD', :git => 'https://github.com/SVProgressHUD/SVProgressHUD.git'
  pod 'DZNEmptyDataSet'
  pod 'EAIntroView'
  pod 'SentrySwift', :git => 'https://github.com/getsentry/sentry-swift.git', :tag => '1.3.2'

  pod 'Mixpanel-swift'
  #pod 'Gloss', '~> 1.2'

  target 'ShoutTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'ShoutUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end


target 'ShareExtension' do
   use_frameworks!
   pod 'Mixpanel-swift'


end

Stack

   CocoaPods : 1.2.0
        Ruby : ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
    RubyGems : 2.6.11
        Host : Mac OS X 10.12.4 (16E195)
       Xcode : 8.2.1 (8C1002)
         Git : git version 2.7.3
Ruby lib dir : /Users/joel/.rvm/rubies/ruby-2.4.1/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ 80b5c67c9c38c4796b84549916c77aaac4efbaeb

Installation Source

Executable Path: /Users/joel/.rvm/gems/ruby-2.4.1/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.1.2
cocoapods-try         : 1.1.0

Podfile

project 'Shout.xcodeproj'

target 'Shout' do
  use_frameworks!

  # Pods for Shout
  #pod 'FBSDKCoreKit'
  #pod 'FBSDKLoginKit'
  pod 'ChameleonFramework/Swift', :git => 'https://github.com/ViccAlexander/Chameleon.git'
  pod 'Eureka', :git => 'https://github.com/xmartlabs/Eureka.git'
  pod 'SVProgressHUD', :git => 'https://github.com/SVProgressHUD/SVProgressHUD.git'
  pod 'DZNEmptyDataSet'
  pod 'EAIntroView'
  pod 'SentrySwift', :git => 'https://github.com/getsentry/sentry-swift.git', :tag => '1.3.2'

  pod 'Mixpanel-swift'
  #pod 'Gloss', '~> 1.2'

  target 'ShoutTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'ShoutUITests' do
    inherit! :search_paths
    # Pods for testing
  end


    target 'ShareExtension' do
        use_frameworks!
        pod 'Mixpanel-swift'


    end

end

Project that demonstrates the issue

ℹ Please link to a project we can download that reproduces the issue.
You can delete this section if your issue is unrelated to build problems,
i.e. it's only an issue with CocoaPods the tool.

Most helpful comment

@orta This was a request that cocoapods actually provide documentation, but ok. It's funny to me that no one wants to maintain their projects anymore.

All 4 comments

Hey there, this looks like a great example of a question that you should ask on StackOverflow - there is an active tag CocoaPods where people can help out with questions like this. We try to keep the CocoaPods issues focused only on bug reports for the tool, and for upcoming feature requests. Which this doesn't look like.

@orta This was a request that cocoapods actually provide documentation, but ok. It's funny to me that no one wants to maintain their projects anymore.

@niedfelj did you find a solution? I totally see the need for documentation on this, as I'm also facing an issue with my share extension that I don't get that seems completely undocumented and landed on this issue.

In my case, seems like this error was somewhat of a misnomer. As with everything computing, unplug and plug back in worked for me in this case. By unplug I mean removed my share extension target, and then plugged it back in and now the error disappeared. Seems like a weird cocoapod bug related to a xcodeproj corruption or something of the sorts.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pronebird picture pronebird  Â·  3Comments

tlandsmancars picture tlandsmancars  Â·  3Comments

marzapower picture marzapower  Â·  3Comments

gerchicov-bp picture gerchicov-bp  Â·  3Comments

steffendsommer picture steffendsommer  Â·  3Comments