我可以在我的iPhone应用程序中使用动态库(共享对象)吗?

我可以在我的iPhone应用程序中使用动态库(共享对象)吗?

问题描述:

众所周知,静态库可以在Iphone应用程序中很好地运行,并且您的应用程序可以很容易地被IOS App Store批准

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

不幸的是,这两个静态库我现在正在使用一些C函数和变量。

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

所以我将它们编译成* .dylib(动态库),并将它们复制到Bundle Resources中XCode。

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();

这在模拟器和Ipad(当然,不同的动态库)中运行良好。

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

我注意到有人说Iphone应用程序不支持任何第三方动态库,我的应用程序将被拒绝。 (见这里)

I noticed that somebody said Iphone app does not support any third party dynamic libraries and my app will be rejected. (see here)

但我仔细阅读了App Store评论指南,我发现没有项目符合我的问题。

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

我现在很困惑!

iphone app是否支持动态库? IOS AppStore是否允许这样做?

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

谁能给我官方回复。

App Store不允许使用动态库。在运行时不能加载任何代码。答案是将它们转换为静态库并将它们编译到应用程序中。

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.

来自iPhoneOSTechOverview:

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

阅读应该as必须

参见SO答案:可以为iOS创建动态库吗?