0

I have a swift base project iPhone app. I would like to use Zoiper SDK within it. What I got from them are static libraries (.a files):

- libcrypto.a
- libsipwrapper.a
- libssl.a

written probably in Objective-C.

And also external header files

- wrapper_defs.h, 
- wrapper_cbk.h, 
- wrapper.h

written in Objective-C.

I tried to add bridging header like this:

#ifndef ZoiperTest_Bridging_Header_h
#define ZoiperTest_Bridging_Header_h

#import "include/wrapper_defs.h"
#import "include/wrapper_cbk.h"
#import "include/wrapper.h"

#endif /* ZoiperTest_Bridging_Header_h */

But that returned lots of errors (types used in wrapper.h not being recognized)

Do I have to include also library .a files into bridging header? What would be exact syntax for that?

I've tried adding #import into bridge header but that gives me file not found error.

daneejela
  • 13,081
  • 7
  • 38
  • 50
  • The .a files are binary and definitely don't belong in headers (or anything else during the compile stage of building). You're probably better off trying to figure out the wrapper.h errors. – Phillip Mills Mar 22 '16 at 13:35
  • Make sure you add the binaries and headers to the project and "copy bundle resources." Does just `#import "wrapper.h"` work rather than `"include/wrapper.h"`? – JAL Mar 22 '16 at 13:42
  • @Phillip Mills, so I don't have to include .a files into briging header? I've tried that, weird, now I got "redefinition of parameter size_t" in one of those headers. I have no experience with objective-c, so I have no clue what could that mean. will google it now. – daneejela Mar 22 '16 at 13:54
  • @JAL I've checked that part, I've tried without folder, it gives the same result. – daneejela Mar 22 '16 at 13:54
  • Could you please provide a couple of samples of errors and the code snippets from the *.h files that the errors refer to? Are you sure the code in the headers is not C++? If it is, then you would have to write a wrapper around the C++ code in either C or Objective-C++. And, as correctly stated by others, the .a files definitely don't belong in the bridging header. – Anatoli P Mar 23 '16 at 00:33
  • Have you tried adding -ObjC, in Other Linker Flag key under Build Settings. – Nuzhat Zari Jan 29 '17 at 09:39

2 Answers2

0

I could integrate zoiper SDK on a swift project. The easy way for me was create an Static Library on Objetive-C with the libs and integrate this on my swift project. -> https://github.com/depazsierra/zoiperExample

On the static library, i reused the ZSDKLibControl that came with zoiper example.

Any question, just let me know.

Depa
  • 11
  • 3
-1

What you can do is the following and it worked for me. Create a static library from scratch. Add the .h (wrappers), including the LibController from the demo. Then once you finish follow this link: How can I use an .a static library in swift?

I was able to use the methods and all but not fully tested yet.

FelixSFD
  • 6,052
  • 10
  • 43
  • 117
highFly
  • 95
  • 1
  • 5