Please add the host targets for the embedded targets to the Podfile

给你一囗甜甜゛ 提交于 2019-12-01 08:10:51

问题


My project is in Swift 2.0. I am try all possible ways but not found any solution.

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 => '8.0'
# ignore all warnings from all pods
inhibit_all_warnings!
use_frameworks!


def available_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

def available_pods_exc
    pod 'Alamofire'
    pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
    pod 'ReachabilitySwift'
    pod 'Kanna', :git => 'https://github.com/tid-kijyun/Kanna.git'
    pod 'AsyncSwift' , :git => 'https://github.com/duemunk/Async.git'
end



target 'link' do
    available_pods

end

target 'ReadLaterExtension' do
    available_pods_exc
    end

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

I found below error

[!] 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)

回答1:


The problem is not in the podfile, but in the project!

To fix:

  • Go to XCode
  • Select your HOST target.
  • Open the target's 'General' page
  • In the 'Embedded Binaries' section, make sure your EXTENSION target is present.

  • In your Podfile you should have:

    target 'HostApp' do .... target 'YourExtension' do .... end end




回答2:


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



来源:https://stackoverflow.com/questions/53607730/please-add-the-host-targets-for-the-embedded-targets-to-the-podfile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!