Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can I use dynamic library(shared object) in my iphone app?

Tags:

ios

iphone

As is known to everyone, static libraries can work well in an Iphone App and your App can be easily approved by IOS App Store

Unfortunately, the two static libraries I'm using now have the some C functions and variables.

so I compiled them into *.dylib (dynamic libraries), and copy 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 somebody said Iphone app does not support any third party dynamic libraries and my app will be rejected. (see here)

but I carefully read the "App Store Review Guidelines", I found no item meet my question.

I'm confused now!

Does iphone app support dynamic libraries? Does IOS AppStore allow this?

Who can give me an official response.

like image 578
aaashun Avatar asked Aug 25 '11 09:08

aaashun


1 Answers

As Bernardo Ramos states in a comment: "Since iOS8 we can use dynamic libraries".

Dynamic libraries are not allowed by the App Store. No code may be loaded at run-time. The answer is to convert them to static libraries and compile them into the application.

From iPhoneOSTechOverview:

"If you want to integrate code from a framework or dynamic library into your application, you should link that code statically into your application’s executable file when building your project."

Read "should" as "must"

See SO Answer: Can create dynamic library for iOS?

like image 200
zaph Avatar answered Oct 19 '22 23:10

zaph