xcode XCode6:接收错误“在框架模块中包含非模块化标头”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28552500/
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 06:39:41  来源:igfitidea点击:

XCode6: Receiving error "Include of non-modular header inside framework module"

xcodexcode6clangios-frameworks

提问by bcattle

I have an iOS app that consists of an app, a bunch of my custom frameworks, and a bunch of third party framweorks:

我有一个 iOS 应用程序,它由一个应用程序、一堆我的自定义框架和一堆第三方框架组成:

App
    MyFramework1
    MyFramework2
        AFNetworking.framework
        Mantle.framework
        ..

I get the error "Include of non-modular header inside framework module" with the following structure:

我收到错误“Include of non-modular header inside framework module”,结构如下:

App/AppDelegate.m
#import <MyFramework2/MyFramework2.h>

MyFramework2/MyFramework2.h
#import "MyClass.h"

MyClass.h
#import <Mantle/Mantle.h>        <-- Error happens here

MyFramework2 builds by itself.

MyFramework2建立本身

Trying to build Appfails with the error "Include of non-modular header inside framework module" at the line that imports Mantle.h.

尝试构建App失败,在导入 Mantle.h 的行中出现错误“Include of non-modular header inside framework module” 。

This issue goes away if I import Mantle.h in the .mfile, but I can't do that because my class inherits from MTLModel, which is defined in Mantle.

如果我在.m文件中导入 Mantle.h,这个问题就会消失,但我不能这样做,因为我的类继承自MTLModelMantle 中定义的 。

This issue has been addressed here, but it isn't Swift-specific.

此问题已在此处解决,但并非特定于 Swift。

Suggestions there are (1) make sure all custom framework headers are public. They are. And (2) go to Build Settings under "Target" and set "Allow Non-modular Includes in Framework Modules" to YES.

建议有 (1) 确保所有自定义框架标头都是公开的。他们是。(2) 转到“目标”下的“构建设置”并将“允许非模块化包含在框架模块中”设置为YES.

Does anyone know why this is happening and how to fix it? Is setting "Allow Non-modular Includes in Framework Modules" to YES considered a good practice? Why is this an error?

有谁知道为什么会发生这种情况以及如何解决?将“允许非模块化包含在框架模块中”设置为“是”是否被认为是一种好习惯?为什么这是一个错误?

Thanks.

谢谢。

回答by Nikos M.

Select the .h file in the project navigator. In the target membership area on the right there is a drop down menu next to the target. Select "public" there (probably "project" is selected right now).

在项目导航器中选择 .h 文件。在右侧的目标成员资格区域中,目标旁边有一个下拉菜单。在那里选择“公共”(现在可能选择了“项目”)。

enter image description here

在此处输入图片说明