1
votes

I have read this solution, but I still cannot get the difference between a bridging header and an umbrella file. I get the same error when I'm using Objective-C library. StackOverflow question

However, I just need to use this .swift code from github. Gzip-NSdata

But I get the same error: using bridging headers with framework targets is unsupported.

I need to use it in a framework I'm developing(not an application). But I don't know where I should add objective-c header. 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". 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.

2

2 Answers

0
votes

It's really strange for me. I reproduce my issue, but I cannot get the same error again, and I build successfully. My steps are as follow:

  1. add header(.h) to my target by File> New> File...> iOS> Source> Header File
  2. add NSData+GZIP.swift(which using libz.dylib) into my target
  3. add libz.dylib to my Linked Framework and Libraries which is under Target> general(a tab) (click + button to add libz.dylib)
  4. tell Xcode where is the header file in Target> Build Settings> Swift Compilier- Code Generation> Objective-C Bridging Header(note it should be the path from your root directory)

And...it builds successfully this time!! Note: if you have to use in another target(ex. unittest), you should follow the steps again.

-1
votes

First remove all your bridge-header files,

Try to create Obj-c file [New File->Source->Obj-C file] and by default it will ask you to create header file.

You should confirm that and it will create yourfilename.m & yourfilename.h files. Now you should import your Obj-c Library to yourfilename.h file

Example:

#import <Parse/Parse.h>

You can remove yourfilename.m file after all.