Does iOS Prefix header only works for objective-c header files and not c's?

288 Views Asked by At

I have two Cocoa Touch Framework projects.

First one have file structure like below:

|--sszip-Prefix.pch
|--ioapi.c
|--ioapi.h

Second one have file structure like below:

|--zipzap-Prefix.pch
|--ZZConstants.h
|--ZZConstants.m

The contents of the Prefix.pch file is the same:

#include <zlib.h>

#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
#include <CoreGraphics/CoreGraphics.h>
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
#include <ApplicationServices/ApplicationServices.h>
#endif

#ifdef __OBJC__
    #import <Foundation/Foundation.h>
#endif

Both ioapi.h and ZZConstants.h need to use stuff in zlib.h

However when I compile both of them, the second project manage to compile without issues while the first project is having tons of Parse Issue errors unless I specifically insert #include "zlib.h" inside ioapi.h header file itself (though this gives another error, see bottom section)

The only difference I can see is ioapi.h is written in C while ZZConstants.h is written in objective-c

So the question is.. Does iOS Prefix header only works for objective-c header files and not c's? If so is there a workaround?

The Back Story:

The reason I need to use the Prefix header is because if I insert #include "zlib.h" directly in the header files, it gives error "Include of non-modular header inside framework module" in both cases.. somehow using the Prefix header won't have this issue.

And the main reason behind all this, is I'm trying to get SSZipArchive (a zip library) to work in Cocoa Touch Framework. I can use it in normal Swift project without issue using the bridging header, but somehow for Cocoa Touch Framework it's a totally different story!

PS: I'm trying to use SSZipArchive in the first project and Zipzap in second project. Zipzap works but it is not very user-friendly.

0

There are 0 best solutions below