首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >请将嵌入式目标的主机目标添加到Podfile

请将嵌入式目标的主机目标添加到Podfile
EN

Stack Overflow用户
提问于 2018-12-04 15:26:42
回答 3查看 3.3K关注 0票数 3

我的项目是Swift 2.0。我尝试了所有可能的方法,但没有找到任何解决方案。

我的pod文件

代码语言:javascript
复制
# 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

我发现了下面的错误

代码语言:javascript
复制
[!] 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)
EN

回答 3

Stack Overflow用户

发布于 2018-12-06 01:13:45

:问题不在播客文件,而在项目!

要修复,请执行以下操作:

  • 转到XCode
  • 选择您的主机目标。
  • 打开目标的“常规”页面
  • 在“Embedded Binaries”部分,确保您的扩展目标存在。

  • 在您的Podfile中,您应该具有:

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

票数 8
EN

Stack Overflow用户

发布于 2018-12-04 15:38:09

为了禁止构建/运行您构建的NSExtension,您应该:

  1. 单击项目中包含的应用程序目标(您要运行的应用程序目标)中的项目文件
  2. 单击构建阶段选项卡
  3. 打开目标Dependencies
  4. Remove extension (您不想运行的扩展模块)
    1. 要将其带回,只需在相同位置单击+号并重新添加它。

在我的案例中,我的工作很成功

票数 1
EN

Stack Overflow用户

发布于 2021-04-20 19:53:53

为了将来参考,我想为这个错误消息添加一个我刚刚发现的原因:

在主要目标构建阶段,部分Embed App Extensions必须在[CP] Copy Pods Resources[CP] Embed Pods Frameworkds之上。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53607730

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档