1024jp / GzipSwift

Swift package that enables gzip/gunzip Data using zlib
MIT License
544 stars 134 forks source link

Cannot use it in my swift framework... #3

Closed jamesweb1 closed 8 years ago

jamesweb1 commented 9 years ago

I'm building a swift framework(not an app) now, and I follow the instruction to add an objective-c bridging header under build settings and add "#import " to this file. I also add libz.dylib library to my linked framework and libraries and with status "required".

But when I build my framework, it shows error message...

error: using bridging headers with framework targets is unsupported

I find the solution in the stack overflow: http://stackoverflow.com/questions/24875745/xcode-6-beta-4-using-bridging-headers-with-framework-targets-is-unsupported

I don't find any "umbrella file" in my Xcode, so I cannot solve this problem.Can any one help me? Thank you very much. Sorry for I'm very new to iOS development.

1024jp commented 9 years ago

I personally don't have any experience making such frameworks on Xcode. However, as long as I read the page in stack overflow, I suppose you need to create your umbrella file manually. An umbrella file should be just a normal header file in which all public import, include etc, are written.

jamesweb1 commented 9 years ago

But what is umbrella file? Where should I find it in Xcode? I only know how to add "objective-c bridging header" in build setting. I have read this article in Apple developer website: https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html However I only get the concept in "Importing Code from Within the Same App Target". The second part "Importing Code from Within the Same Framework Target" makes me confused. It said "In your umbrella header file, import every..." But apple didn't tell me where it is? where I should set this? If someone knows, please give me some hint, thanks.

1024jp commented 9 years ago

As I mentioned, an umbrella file is just a normal header file. Just add a normal objective-C header file to your project.

Actually, this issue tracker is not for all Xcode or programming issues but just for the NSData+GZIP library. You'd better to ask it somewhere more suitable. Or to google words like "umbrella file", Xcode, framework etc.

jamesweb1 commented 9 years ago

Even if include #include <zlib.h> in umbrella header still cannot work in framework. Because framework cannot include non-modular header, Xcode will show this message. I have a similar question here:https://github.com/CocoaPods/CocoaPods/issues/3666

stephenyao commented 8 years ago

Also having this issue, have you found a resolution?

1024jp commented 8 years ago

I'm not sure if this helps, but this is how I use this extension in my framework: screen shot 2016-05-31 at 19 40 34

The other things are the same. Link binary with libz.tbd and set Swift compiler import path correctly.

1024jp commented 8 years ago

Now you can try swift3 branch that supports framework.