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

12,637

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

Share:
12,637

Related videos on Youtube

bcattle
Author by

bcattle

Updated on June 04, 2022

Comments

  • bcattle
    bcattle almost 2 years

    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.

  • SinisterMJ
    SinisterMJ about 9 years
    Note this is a problem even if you have turned on the CLANG setting for "Allow Non-modular Includes In Framework Modules", which your answer solves. Thanks.
  • Bonnke
    Bonnke over 8 years
    @Nikos M. can you please add a screenshot. I cant see that dropdown. Please help. Many thanks
  • lenhhoxung
    lenhhoxung over 8 years
    Where is the dropdown menu for target membership?
  • Nikos M.
    Nikos M. over 8 years
    @lenhhoxung it is not a dropdown menu. It's in the right sidebar with the properties.
  • lenhhoxung
    lenhhoxung over 8 years
    @NikosM. Thanks, but it's not applicable for me because the header file is installed via cocoapods
  • zaxy78
    zaxy78 almost 8 years
    mine is public and still getting this. :(
  • Shrikant K
    Shrikant K over 7 years
    @zaxy78 hey how did you resolved ? Im facing still same here after making public also..