使用cocoapods构建静态库 [英] Building a static library with cocoapods

查看:151
本文介绍了使用cocoapods构建静态库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个在Podfile中指定的具有不同依赖关系(例如AFNetworking)的静态库。我不希望依赖项包含在最终的静态库中(调用libMyProject.a),我只想链接它们然后创建一个MyProject.Podspec文件,我可以在其中放置相同的依赖项。

I am trying to build a static library that has different dependencies (AFNetworking for example) specified in a Podfile. I don't want the dependencies to be included in the final static library (call libMyProject.a), I just want to link against them and then create a MyProject.Podspec file where I can put the same dependencies.

问题在于,当我构建libMyProject.a时,libPods.a被链接和包含,所以如果我分发libMyProject.a而其他人将它集成到一个项目中,该项目使用了一些相同的依赖关系,它将有重复的符号问题。

The problem is that when I build libMyProject.a the libPods.a is linked and included, so that if I distribute libMyProject.a and other people integrates it in a project which uses some of the same dependencies it will have duplicate symbols issues.

如何链接libPods.a lib但不包含在libMyProject.a中?它应该像链接其他现有框架一样工作。

How can I link against the libPods.a lib but not include it in libMyProject.a? It should work just like linking with other existing frameworks.

谢谢!

推荐答案

我通过删除libPods解决了这个问题。来自Build Phases的Link Binary with Libraries部分的lib。

I solved it by removing the libPods.a lib from the section "Link Binary With Libraries" in Build Phases.

这篇关于使用cocoapods构建静态库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆