Include of non-modular header inside framework module

来源:互联网 发布:一元淘宝秒杀 编辑:程序博客网 时间:2024/05/22 14:30

1. 

Try going Build Settings under "Target" and set "Allow Non-modular Includes in Framework Modules" to YES.


The real answer is that the location of the imports needs to be changed by the library owner. Those files ifaddrs.h, arpa/inet.h, sys/types.h are getting imported in a .h file in a framework, which XCode doesn't like. The library maintainer should move them to a .m file. See for example this issue on Github, where AFNetworking fixed the same problem: 

https://github.com/AFNetworking/AFNetworking/issues/2205


2.

You can set Allow Non-modular includes in Framework Modules in Build Settings for the affected target to YES. This is the build setting you need to edit:

Build Settings item you need to edit

NOTE: You should use this feature to uncover the underlying error, which I have found to be frequently caused by duplication of angle-bracketed global includes in files with some dependent relationship, i.e.:

#import <Foo/Bar.h> // referred to in two or more dependent files

If setting Allow Non-modular includes in Frame Modules to YES results in a set of "X is an ambiguous reference" errors or something of the sort, you should be able to track down the offending duplicate(s) and eliminate them. After you've cleaned up your code, set Allow Non-modular includes in Frame Modules back to NO.

3. 


2
down vote

I had the same problem and solve it by just making header file public.[problem]

If you are working on multiple modules in your project. Then your header file needs to be public to be used in other parts of projects. What you need is to select that header file, and in project Utilities view. Change the file from Project/Private to Public. See image below:

Changing header file scope


4. 


1
down vote

I had the same issue and nothing from above helped me. So I hope my answer will be helpful for somebody. In my case the problem was in ALWAYS_SEARCH_USER_PATHS setting. When it was set to NO project built and worked ok. But as far as one of the pod required it to be set to YES I was receiving an error

Include of non-modular header inside framework module

After couple cups of coffee and all day researching I found out that according to known issues of Xcode 7.1 Beta 2 release notes:

• If you get an error stating "Include of non-modular header inside framework module" for a framework that previously compiled, make sure the "Always Search User Paths" build setting is set to "No". The default is "Yes" only for legacy reasons. (22784786)

I was using XCode 7.3 though, but seems like this bug hasn't been fixed yet.