Search code examples
iosobjective-ccswiftphp-ziparchive

"Include of non-modular header inside framework module" in C header of SSZipArchive


I'm trying to use SSZipArchive objc library in my Swift iOS Project.

What I did:

  1. Created an Objective-C "Cocoa Touch Framework"
  2. Followed this guide to import SSZipArchive's objective C and C files into it.
  3. Changed all C headers to public as per this answer
  4. Change build settings to allow non-modular includes as per this answer

The framework compiles fine. I'd manage to use objective C libraries in Swift projects using this way before so I guess the steps are correct?

The problem right now is when I try do Import SSZip in my project and try to compile, it gives "Include of non-modular header inside framework module" errors for each of the C header files of SSZipArchive and I've tried all possible solutions I can find online with no success. Seems like the problem centers on zlib.h

Screenshot of compilation error

Please help.. I'm stuck for more than a week now and I couldn't find any alternatives to unzip a file in swift.


Solution

  • I got this to work. You need to move all the #includes that causes problem out from its .h file and put them in its .c file instead. After that clean and recompile and the error goes away and everything works.