简体   繁体   中英

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

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.

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?

No, dynamic libraries are not allowed.

But you can create static libraries, and even "static frameworks" (that is, like a classic framework is, a folder with the ".framework" extension and containing your Headers, resource files if any, and the lib itself, except that your lib must be a static library).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM