Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

App
    MyFramework1
    MyFramework2
        AFNetworking.framework
        Mantle.framework
        ..

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

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.

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

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

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

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.

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.

like image 487
bcattle Avatar asked Feb 17 '15 00:02

bcattle


1 Answers

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).

enter image description here

like image 134
Nikos M. Avatar answered Sep 19 '22 15:09

Nikos M.