Is it possible to use a dynamic library (shared object) in my iphone application?

As everyone knows, static libraries can work well in the Iphone app, and your app can be easily approved by the IOS App Store

Unfortunately, the two static libraries that I use now have some C functions and variables.

so I compiled them into * .dylib (dynamic libraries) and copied them to "Bundle Resources" in Xcode.

dylib_handle = dlopen(dylib_path_in_resource_bundle, RTLD_LAZY); func = dlsym(dylib_handle, "func"); // invoke func(); 

This works well in simulator and ipad (of course, different dynamic libraries).

I noticed that someone said that the Iphone application does not support third-party dynamic libraries, and my application will be rejected. (see here)

but I carefully read the "Recommendations for checking the app store", I did not find a single item that answers my question.

Now I'm confused!

Does iphone support dynamic libraries? Does the iOS AppStore support this?

Who can give me an official answer.

+6
source share
2 answers

Dynamic libraries are not allowed on the App Store. At runtime, the code cannot be loaded. The answer is to convert them to static libraries and compile them into an application.

From iPhoneOSTechOverview:

"If you want to integrate code from a framework or a dynamic library into your application, you must link this code statically to the application executable when creating your project."

Reading "should" as "should"

See SO Answer: Can I create a dynamic library for iOS?

+6
source

No, dynamic libraries are not allowed.

But you can create static libraries, and even “static frameworks” (that is, as a classic structure, it is a folder with the extension “.framework” and contains your headers, resource files, if any, and lib itself, except that your library must be a static library).

+1
source

Source: https://habr.com/ru/post/895841/


All Articles