构建iOS静态库

发布于 2024-12-11 17:19:41 字数 100 浏览 0 评论 0原文

我有一个依赖于某些 Apple 框架的静态库,但当我将其作为目标依赖项包含时,我仍然需要将其依赖的框架添加到应用程序项目中。是否有某种方法可以设置项目,以便只需在静态库目标中指定依赖项?

I have a static library that depends on some of the Apple frameworks though when I include it as a target dependency I still need to add the frameworks it depends on to the application project. Is there some way to setup the project such that the dependencies only have to be specified in the static library target?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧城空念 2024-12-18 17:19:41

虽然我确信这是可能的,但您确实不想这样做。我不确定如果你这样做的话是否能够被录取。静态库与动态库链接,符号不像 .m 文件那样包含在其中。这就是动态库的全部意义。

一种解决方案是使用 xcconfig 文件。

http://developer.apple.com/library/ ios/#recipes/xcode_help-project_editor/Articles/BasingBuildConfigurationsonConfigurationFiles.html

在这种情况下,您创建一个静态库附带的可共享 xcconfig 文件。然后在您的应用程序项目中复制 xcconfig 文件并以此为基础进行应用程序配置。

OTHER_LDFLAGS = $(SHARED_LDFLAGS) -framework AssetsLibrary -framework AudioToolbox ...

While I'm sure it is possible, you really don't want to do that. I'm not sure you'd be able to get accepted if you did that. The static library is linking against dynamic library, the symbols are not included in it like the .m files are. That is the whole point of dynamic libraries.

One solution is to use an xcconfig file.

http://developer.apple.com/library/ios/#recipes/xcode_help-project_editor/Articles/BasingBuildConfigurationsonConfigurationFiles.html

In this scenario you create a sharable xcconfig file that accompanies the static library. Then in your application project you copy the xcconfig file and base your application configuration on it.

OTHER_LDFLAGS = $(SHARED_LDFLAGS) -framework AssetsLibrary -framework AudioToolbox ...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文