Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
427 views
in Technique[技术] by (71.8m points)

ios - 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...