Connect C library to iOS app

I hope there is someone who can help me with the following.

I currently have an Android app that connects to the C library using JNI. Now I would like to connect my iOS application to the same C library, but how can I call functions and how can I access interfaces without JNI?

Hope someone has some good tips or tutorials.

So, I have an Android app, an iOS app, and a C library adapted to JNI (Java Native Interface). Part of Android is working. But now I would like to use as much as possible, but still connect my iOS application to this (or most) library. (the library is a separate header and .c files)

Please, help:)

+4
source share
2 answers

You have two options:

  • Directly use your library by adding it to the project in xcode, assign a library search path, assign a title search path and include the headers in the .m objective-c source code that uses it.
  • Add all the .c files that you need to compile and link using xcode and include the headers in the .m objective-c source code that uses it.

ps if you used some specific compilers, you may need to rebuild your libraries in order to properly configure iOS.

+2
source

To clarify my comment a bit - unlike Android, iOS apps are built using Objective-C with Apple libraries. Object C is a superset of C, which means that any valid C code is also valid Objective C. You must be able to add source files directly to your iOS project in Xcode and sprinkle library calls anywhere. This means that there is nothing better than JNI for iOS (or OSX) development.

+3
source

All Articles