I have seen plenty of answers around about the issue but non of them are based on my case and "ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES" does not work either.
I am developing a framework that is an implementation of a C library. The library is OpenHome and after compiling it and creating the fat libs I have a folder with all the .a and the headers.
Since It has a folder for "Debug" and "Release", I copy this 2 folders in the root of my project, I import the .a files into my "Link binary with libraries" and, in the "Build Settings" of my target, I set the "Header Search Path" with the location of the headers folder.
for importing all the Headers I need to implement I use a c++ class called "MyHeaders.hpp & MyHeader.cpp", I make the the .hpp pubic and I import it like that in my MyFramework.h (Umbrella file):
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdocumentation"
#import "MyHeaders.hpp"
#pragma clang diagnostic pop
MyHeaders.hpp:
#ifndef MyHeaders_hpp
#define MyHeaders_hpp
#include <stdio.h>
/*** CP -PROXIES- ***/
/** Header That Includes all the CP Related Headers **/
#include "OpenHome/Net/C/CpStack.h"
/** CP Services **/
/*UPnP*/
#include "OpenHome/Net/C/CpUpnpOrgConnectionManager1.h"
#include "OpenHome/Net/C/CpUpnpOrgRenderingControl1.h"
#include "OpenHome/Net/C/CpUpnpOrgAVTransport1.h"
#endif /* MyHeaders_hpp */
The error come from each include. I have replaced wit import but it also doesn't work.
It is worth mentioning that this project configuration was the one I used in the project (Single View Application) I started implementing and testing. The only difference was the existence of the bridging header.
Any Ideas?
Well after a researching i found the issue and the solution
When I am #include "OpenHome/Net/C/CpUpnpOrgConnectionManager1.h"
this header is either not public or contains non public headers.
The solution for importing this headers in a Swift based framework is to to create a Module.
I have created a folder "MyModuleFolder" in my target folder and I have created a "module.modulemap" file inside that looks like
module OHNet[system]{
header "MyHeaders.hpp"
export *
}
After that, in "Build Settings" -> "Swift Compiler - Search Paths " -> "Import Paths" i have added the location for "MyModuleFolder".
Finally,
import OHNet
in each swift file
I hope it helps.