iOS: "Include of non

I'm trying to build my own framework 'VBL' that uses TouchXML which is based on libxml.dylib

The framework is building fine, but whenever I'm trying to use it in any project, I got the following error:

"Include of non-modular header inside framework module VBL.CXMLNode"

And that's specifically because in header CXMLNode.h inside my framework, I have to include libxml as follows:

#include <libxml/tree.h>

Is it safe to set the following property inside Build Settings to YES?

allow non-modular included in framework modules

But this will not work with Swift anyways, so any other suggestions?


You can try to hide the #include <libxml/tree.h> in a private header or in the .m file if you can.

You can also try to create a module.modulemap file with the libxml root header inside to fool the swift compiler:

module Libxml [system] {
    header "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/libxml2/libxml/tree.h"
    export *
}

Then place the file inside a folder, -module/module.modulemap- for example.

Once you did that you should link it in import paths within the swift compiler search path section of the target build setting , and to the target's header search path :

$(SRCROOT)/module

Then in your code, you can use @import libxml;

链接地址: http://www.djcxy.com/p/84782.html

上一篇: Linux中/ queue / rotation有什么意义?

下一篇: iOS:“包含非