objective-c 模块“myFramework”的伞头不包括头“otherFramework.h”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32923483/
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
umbrella header for module 'myFramework' does not include header 'otherFramework.h'
提问by hibento
My Swift / iOS9 framework 'viewer_protocol' uses another and external Objective-C framework (CocoaAsyncSocket). I'm using Carthage to build CocoaAsyncSocket. So far everything works fine: In have an example App inside my framework Xcode Project using my framework without any problems.
我的 Swift / iOS9 框架 'viewer_protocol' 使用另一个外部 Objective-C 框架(CocoaAsyncSocket)。我正在使用 Carthage 构建 CocoaAsyncSocket。到目前为止一切正常:在我的框架 Xcode 项目中有一个示例应用程序,使用我的框架没有任何问题。
Now I want to use my Framework in a different Xcode Project - although using Carthage. I include only my Framework as a dependency and Carthage automatically resolves the dependencies to CocoaAsyncSocket. I embedded both frameworks into this new Xcode Project and build my App: Everything works fine here - except one warning I can't rid off:
现在我想在不同的 Xcode 项目中使用我的框架 - 尽管使用 Carthage。我只包含我的框架作为依赖项,Carthage 会自动将依赖项解析为 CocoaAsyncSocket。我将这两个框架嵌入到这个新的 Xcode 项目中并构建了我的应用程序:这里一切正常 - 除了一个我无法摆脱的警告:
/Users/John/Repositories/my_project/<module-includes>:1:1:
Umbrella header for module 'my_project' does not include header 'GCDAsyncSocket.h'
This is my framework header:
这是我的框架标题:
#import <UIKit/UIKit.h>
//! Project version number for my_project.
FOUNDATION_EXPORT double my_projectVersionNumber;
//! Project version string for my_project.
FOUNDATION_EXPORT const unsigned char my_projectVersionString[];
// In this header, you should import all the public headers of your framework
using statements like #import <my_project/PublicHeader.h>
#import <CocoaAsyncSocket/CocoaAsyncSocket.h>
As you can see CocoaAsyncSocket.h is imported. Furthermore inside my framework the CocoaAsyncSocket.h file is included:
如您所见,CocoaAsyncSocket.h 已导入。此外,在我的框架中还包含 CocoaAsyncSocket.h 文件:
What I am missing here? I'm using several others external frameworks inside my framework, there're no warnings for them - all of these external frameworks are written in Swift - CocoaAsyncSocket is pure Objective-C.
我在这里缺少什么?我在我的框架中使用了其他几个外部框架,没有警告它们 - 所有这些外部框架都是用 Swift 编写的 - CocoaAsyncSocket 是纯 Objective-C。
This is my frameworks module.modulemap:
这是我的框架 module.modulemap:
framework module my_project {
umbrella header "my_project.h"
export *
module * { export * }
}
module viewer_protocol.Swift {
header "my_project-Swift.h"
}
Update
更新
I found a solution: Changing the import statement in my framework header from
我找到了一个解决方案:将框架标头中的导入语句从
#import <CocoaAsyncSocket/CocoaAsyncSocket.h>
to
到
#import "CocoaAsyncSocket/CocoaAsyncSocket.h"
Now Xcode finds the header file and the warning disappears.
现在 Xcode 找到头文件并且警告消失了。
回答by AyJay
I recently ran into same issue. Apparently I had header file set as publicin target membership, but it was not exposed in umbrella header. Fixed issue by making header file with projectaccess instead of public.
我最近遇到了同样的问题。显然我public在目标成员资格中设置了头文件,但它没有在伞头中公开。通过使头文件具有project访问权限而不是public.
回答by swiftBoy
I had the same issue today
我今天遇到了同样的问题
Umbrella header for module 'HockeySDK' does not include header 'BITHockeyBaseViewController.h'
模块“ HockeySDK”的伞头不包括头“ BITHockeyBaseViewController.h”
and the solution was
解决方案是
1.build and run project and go-to Report Navigator
1.构建并运行项目并转到报告导航器
2.look at the warning, click to expand details
2.查看警告,点击展开详情
it will so you the file name where you need to make change as you can seen in below screen shot
它将为您提供需要更改的文件名,如下面的屏幕截图所示
So i just updated my import statement in AppDelegate.m file
所以我只是在 AppDelegate.m 文件中更新了我的导入语句
New
新的
#import "HockeySDK/HockeySDK.h"
Old
老的
#import <HockeySDK/HockeySDK.h>
and issue gone..
问题消失了..
hope this will help someone. who are coming here for solution.
希望这会帮助某人。谁来这里寻求解决方案。
回答by Senseful
I had the same issue. Seemed to be related to old build files.
我遇到过同样的问题。似乎与旧的构建文件有关。
The standard Xcode problem fixer worked for me:
标准的 Xcode 问题修复程序对我有用:
- Clean project
- Deleted derived data
- Restart Xcode
- 清洁工程
- 删除派生数据
- 重启Xcode
回答by Oded Regev
For me the solution was as follows:
对我来说,解决方案如下:
1) Each Objective C framework has 1 header file that contains all the:
1) 每个 Objective C 框架都有 1 个头文件,其中包含所有:
#import ...
#import ...
#import ...
2) Make sure that this file imports the missing header.
2) 确保此文件导入缺少的标题。
3) Build the project again, it should remove the warning.
3) 再次构建项目,它应该消除警告。
回答by iwasrobbed
Alternatively, you may have exposed files within the Publicarea of your framework's build phases that should actually be moved back to the Projectarea.
或者,您可能在Public框架构建阶段的区域内暴露了文件,这些文件实际上应该移回该Project区域。
If you don't want those files to be within your framework's umbrella header so they're publicly accessible, you can revert this.
如果您不希望这些文件位于您的框架的伞形标头中以便它们可公开访问,您可以还原它。
Goto Framework -> Target -> Build Phases and drag to move the unnecessary header files from Public to Project.
转到 Framework -> Target -> Build Phases 并拖动以将不必要的头文件从 Public 移动到 Project。


回答by pflous
Just for completeness if your header is set to public in :
如果您的标头设置为 public in ,则只是为了完整性:
Build Phases > Headers
构建阶段 > 标头
You should either
你应该
Include the import in your main header as others have mentioned
正如其他人提到的那样,将导入包含在您的主标题中
OR
或者
Move that header to "private" if it doesn't need to be exposed
如果不需要公开,则将该标头移至“私有”
回答by AnneTheAgile
We got this recently and it was due to corruption in DerivedData. Deleting that folder fixed the problem.
我们最近得到了这个,这是由于 DerivedData 中的损坏。删除该文件夹解决了问题。
回答by szubiszon
In my case (Obj-c framework):
就我而言(Obj-c 框架):
Umbrella header for module 'opus' does not include header 'opus_multistream.h'
I needed to change:
我需要改变:
@import opus.opus_defines;
into
进入
@import opus;
(I don't have in #import "....h"or #import <....h>for frameworks)
(我没有 in#import "....h"或#import <....h>for 框架)
回答by mjl007
Take a look at this post:
看看这个帖子:
It goes over the concepts of the new module importing. I had my own custom framework and after adopting the new method to import objective-c framework
它回顾了新模块导入的概念。我有自己的自定义框架,采用新方法导入objective-c框架后
old:
#import <MyFramework/MyFramework.h>
老的:
#import <MyFramework/MyFramework.h>
new:
@import MyFramework;
新的:
@import MyFramework;
it took care of the warning/
它处理了警告/
回答by user1105951
For others : In my case I already move the headers I want to expose from my framework, from "project" to "public" (Build phases of the framework target)
对于其他人:在我的情况下,我已经将要从框架中公开的标题从“项目”移动到“公共”(框架目标的构建阶段)
Then Xcode gave my this warning.
然后Xcode给了我这个警告。
Xcode is telling us that we also need to add #import "name of header in the warning> in the public header file that was created with framework, so the clients (of the framework) will know this header.
Xcode 告诉我们,我们还需要在使用框架创建的公共头文件中添加 #import "name of header in the warning>,以便(框架的)客户端知道这个头文件。
So The Fix:
1.go to the framework public header file.(the one what created by xcode when you created the framework) .
2. add #import "the-name-of-the-header-in-the-warning.h"
所以修复:
1.转到框架公共头文件。(创建框架时由xcode创建的那个)。
2. 添加#import "the-name-of-the-header-in-the-warning.h"

