Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to find host target(s) for Keyboard and iMessage app extension #6256

Closed
1 task done
dalu93 opened this issue Nov 30, 2016 · 12 comments
Closed
1 task done

Unable to find host target(s) for Keyboard and iMessage app extension #6256

dalu93 opened this issue Nov 30, 2016 · 12 comments
Labels
s1:awaiting input Waiting for input from the original author

Comments

@dalu93
Copy link

dalu93 commented Nov 30, 2016

Report

What did you do?

Run pod install

What did you expect to happen?

Install all pod dependencies correctly.

What happened instead?

I got this error in console
Unable to find host target(s) for ***Keyboard, ***iMessageApp.

CocoaPods Environment

Stack

   CocoaPods : 1.1.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.1 (16B2555)
       Xcode : 8.1 (8B62)
         Git : git version 2.9.3 (Apple Git-75)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ b4e272bd703ca26cae4ebf7547a0fb9d33580d5d

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.1.1
cocoapods-try         : 1.1.0

Podfile

platform :ios, '9.0'
project '***.xcodeproj'
use_frameworks!
inhibit_all_warnings!

def communication_pods
    pod 'Argo'
    pod 'Curry'
    pod 'Alamofire', '~> 4.0'
end

def global_pods
    communication_pods
    pod 'AlamofireImage', '~> 3.1'
end

target '***App' do
    global_pods
    
    target '***Tests' do
        inherit! :search_paths
        pod 'Quick'
        pod 'Nimble'
    end
    
    target '***UITests' do
        inherit! :search_paths
    end
end

 target '***Keyboard' do
     global_pods
 end

 target '***iMessageApp' do
     global_pods
 end

post_install do |installer|
    # NOTE: If you are using a CocoaPods version prior to 0.38, replace `pods_project` with `project` on the below line
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['SWIFT_VERSION'] = '3.0'
        end
    end
end
@dalu93 dalu93 changed the title [1.1.1] Unable to find host target(s) for Keyboard and iMessage app extension Unable to find host target(s) for Keyboard and iMessage app extension Nov 30, 2016
@benasher44
Copy link
Member

Hi! Could you post a screenshot (or just a text list) of what shows up in the list in the "Target Dependencies" build phases for your ***App?

@benasher44 benasher44 added the s1:awaiting input Waiting for input from the original author label Nov 30, 2016
@dalu93
Copy link
Author

dalu93 commented Nov 30, 2016

Oh I noticed that the Target Dependencies field was empty. Adding the two extensions target fixed the issue. Thanks

@dalu93 dalu93 closed this as completed Nov 30, 2016
@benasher44
Copy link
Member

Awesome! Glad you got it fixed, and we appreciate you posting the solution!

@orta
Copy link
Member

orta commented Nov 30, 2016

BTW, if you want to make your Podfile a bit simpler, you could do:

[...]

abstract_target "App Pods" do
    target '***App'
    target '***Keyboard'
    target '***iMessageApp'

    pod 'Argo'
    pod 'Curry'
    pod 'Alamofire', '~> 4.0'
    
    abstract_target 'Test Pods' do
        inherit! :search_paths
        target '***Tests'
        target '***UITests'
        pod 'Quick'
        pod 'Nimble'
    end
end

[...]    

@dalu93
Copy link
Author

dalu93 commented Dec 1, 2016

HI @orta, thanks for the tip.
In this case, how to add a pod to the main app target only? I know this syntax results more concise, but for any customization I have to extract the target from the abstract one. Probably I'll prefer to stay with the old and not-pretty Podfile version. Just for my personal curiosity, will a solution like the one below work?

abstract_target "Generic Pods" do
    target '***Keyboard'
    target '***iMessageApp'
    
    pod 'Argo'
    pod 'Curry'
    pod 'Alamofire', '~> 4.0'
    pod 'AlamofireImage', '~> 3.1'
    
    abstract_target 'Main App Pods' do
        inherit! :search_paths
        target '***App'
        pod 'FBSDKLoginKit'
        pod 'FBSDKCoreKit'
        pod 'FBSDKShareKit'
    end
    
    abstract_target 'Test Pods' do
        inherit! :search_paths
        target '***Tests'
        target '***UITests'
        pod 'Quick'
        pod 'Nimble'
    end
end

@orta
Copy link
Member

orta commented Dec 1, 2016

Hrm, I think if you remove the inherit! :search_paths from Main App Pods then it should be 👍

@dalu93
Copy link
Author

dalu93 commented Dec 1, 2016

After using the new Podfile version, I got an error

framework not found Pods_***_iMessageApp

while archiving (debug was fine).
Under linked libraries settings, each target is linked to Pods_TARGETNAME.framework and the Pods_Generic_Pods_targetname.framework too. Is it right?

The Podfile I'm using is exactly the same I posted before, without the inherit! :search_paths line as @orta said

PS: the pod install operation removed also all my schemes

@dalu93
Copy link
Author

dalu93 commented Dec 1, 2016

Seems like pod deintegrate and pod install fixed it. As I said, the target was still linked to the old .framework

@dalu93
Copy link
Author

dalu93 commented Dec 1, 2016

Again me, just FYI, after user that Podfile, the test targets weren't compiling. Of course I forgot to move the test abstract target inside the Main App abstract target.

@Chiragtrootech
Copy link

Chiragtrootech commented Dec 4, 2018

This is my pod file

# Uncomment this line to define a global platform for your project
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, :deployment_target => '9.0'
# ignore all warnings from all pods
inhibit_all_warnings!
use_frameworks!

def all_pods
    pod 'IQKeyboardManager'
    pod 'Instabug'
    pod "TSMessages"
    pod 'AsyncSwift' , :git => 'https://github.com/duemunk/Async.git'
    
    pod 'Onboard' # not used
    pod 'DZNEmptyDataSet' # not used
    pod 'iOS-Slide-Menu'
    pod 'Kanna', :git => 'https://github.com/tid-kijyun/Kanna.git'
    pod 'HanekeSwift', :git => 'https://github.com/Haneke/HanekeSwift.git'
    pod 'Alamofire'
    pod 'ObjectMapper', :git => 'https://github.com/Hearst-DD/ObjectMapper.git'
    pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
    pod 'ReachabilitySwift'
    pod 'SCLAlertView'
    pod 'ImageLoader'
    pod 'NVActivityIndicatorView', :git => 'https://github.com/ninjaprox/NVActivityIndicatorView.git'
    pod 'ActiveLabel'
    pod 'MWFeedParser'
    pod "SwiftElegantDropdownMenu"
    pod 'SwiftHEXColors'
    pod 'UITextView+Placeholder'
    #pod "AFDateHelper"
    pod 'DateTools'
    pod "SwiftDate", "~> 2.0"
    pod 'APAddressBook/Swift'
    pod 'FBSDKLoginKit'
    pod 'FBSDKCoreKit'
    pod 'FBSDKShareKit'
    pod 'PusherSwift', git: 'https://github.com/pusher/pusher-websocket-swift.git', branch: 'push-notifications'
   
    
end

target 'link' do
    all_pods
    end
	
target 'ReadLaterExtension' do
   
all_pods

    end

target 'Link Tests' do
	pod 'Quick', '0.3.1'
	pod 'Nimble'
end

post_install do |installer|
    # NOTE: If you are using a CocoaPods version prior to 0.38, replace `pods_project` with `project` on the below line
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['SWIFT_VERSION'] = '3.0'
        end
    end
end

error is
Unable to find host target(s) for ReadLaterExtension. 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)

pls help me to solve this

thank you

@Chiragtrootech
Copy link

In order to disable building/running the NSExtension you build, you should:

  1. Click the project file in the project navigator
  2. Click the containing app target (the one you DO want to run)
  3. Click Build Phases tab
  4. Open Target Dependencies
  5. Remove the extension (the one you DON'T want to run)
  6. To bring it back, simply click the + sign in the same place and
    re-add it.

In my case working sucessfully

@sitnikovdev
Copy link

sitnikovdev commented Dec 3, 2020

  1. Remove the extension (the one you DON'T want to run)

In my case working sucessfully

In my case I just add extension that was in error string. That fix issue. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s1:awaiting input Waiting for input from the original author
Projects
None yet
Development

No branches or pull requests

5 participants