Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
456 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 Reply

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?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...