xcode 没有找到目标的伞头,将不会生成模块映射

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30704268/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 07:15:11  来源:igfitidea点击:

no umbrella header found for target, module map will not be generated

iosxcode

提问by Quanlong

When I trying build CKCountdownButtonas a framework in Xcode 6.3, it complains with

当我尝试在 Xcode 6.3 中构建CKCountdownButton作为框架时,它抱怨

warning: no umbrella header found for target 'CKCountdownButton', module map will not be generated

警告:未找到目标“CKCountdownButton”的伞头,将不会生成模块映射

Then when I import this framework in other project, it failed with No such module 'CKCountdownButton'

然后当我在其他项目中导入这个框架时,它失败了,没有这样的模块 'CKCountdownButton'

采纳答案by Quanlong

Add a CKCountdownButton.hin framework fixed this issue.

添加一个CKCountdownButton.h框架修复了这个问题。

I think the umbrella header means the header file with same name like Framework

我认为伞头是指与框架同名的头文件

回答by Quanlong

I found another solution, Xcodeprovides a way to specify umbrella headerthrough Module Map Fileconfiguration.

我找到了另一个解决方案,Xcode提供了一种通过Module Map File配置指定伞头的方法。

snapshot

快照

The contents of module.modulemapshould be:

内容module.modulemap应该是:

framework module Foo {
    umbrella header "Bar.h"

    header "other-header.h"

    export *
    module * { export * }
}

回答by onmyway133

That target needs to have at least 1 Swift file. Check that you have Swift files added to the target

该目标至少需要 1 个 Swift 文件。检查您是否已将 Swift 文件添加到目标

回答by Sandeep

I had the same problem with 'GoogleToolbox'. It happened when I tried to update my pod repo and some error happened. Just did 'pod install' from terminal on the project folder and everything got ok.

我在使用“GoogleToolbox”时遇到了同样的问题。当我尝试更新我的 pod 存储库时发生了一些错误。刚刚从项目文件夹上的终端执行了“pod install”,一切正常。

回答by yoAlex5

Custom module map for a framework[About]

框架的自定义模块映射[关于]

Create an umbrella file- any .hfile (or autogenerated <product_name>.hfor Framework target)

创建umbrella file- 任何.h文件(或<product_name>.h为框架目标自动生成)

Add all .hfiles that will be open for consumer into umbrella file

将所有.h将对消费者开放的文件添加到umbrella file

#import "header_1.h"
#import "header_2.h"

Add the umbrella fileand headers files .hfrom it (header_1.h, header_2.h) to the Headerssection[can not do it][public target membership]

添加umbrella file和头文件.h从它(header_1.h,header_2.h)的Headers部分[做不到] [公共目标会员]

Select `.h` file -> Select File Inspectors Tab -> Target Membership -> Select the target and make it **public**
//or
Project editor -> select a target -> Build Phases -> Headers -> add files to the **public** zone

Create a .modulemapfile

创建.modulemap文件

framework module product_name {
    umbrella header "<umbrella_name>.h"
    export *
}

Check Defines Module

查看 Defines Module

Build Settings -> Defines Module -> YES

Specify Module Map File

指定 Module Map File

Build Settings -> Module Map File -> relative path to `.modulemap` file