构建iOS静态库
我有一个依赖于某些 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
虽然我确信这是可能的,但您确实不想这样做。我不确定如果你这样做的话是否能够被录取。静态库与动态库链接,符号不像 .m 文件那样包含在其中。这就是动态库的全部意义。
一种解决方案是使用 xcconfig 文件。
http://developer.apple.com/library/ ios/#recipes/xcode_help-project_editor/Articles/BasingBuildConfigurationsonConfigurationFiles.html
在这种情况下,您创建一个静态库附带的可共享 xcconfig 文件。然后在您的应用程序项目中复制 xcconfig 文件并以此为基础进行应用程序配置。
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.