Xcode引用框架而不是链接二进制与库 [英] Xcode reference a framework instead of link binary with libraries
问题描述
在开发可可触摸框架时,如何通过引用第三方框架中的代码,然后将其包含在链接二进制库与库选项中,来使用第三方框架中的代码。
When developing cocoa touch framework, how can i use code from third party framework by referencing it other then including it in the "link binary with libraries" option?
我不想链接到二进制,以防止主机项目和框架之间的符号冲突(项目将使用框架)
I dont want to link to binary in order to prevent symbol conflicts between hosting project and the framework (project which will use the framework)
此外,我将需要框架代码使用托管项目引用第三方框架,该如何做?
Additionally i will need the framework code to use the hosting project reference to the third party framework, how can it be done?
或者我应该采取不同的方法,例如静态框架(我不熟悉小两者的差异)
Or should i take different approach for example static framework (i am not familiar with the small differences of the two)
推荐答案
- 选择要修改的目标并显示其构建阶段。
- 展开链接二进制库与库构建阶段,以查看目标链接的框架。
- 如果您要弱链接的框架是列出在链接二进制与库构建阶段,选择它,并选择编辑>删除,以删除它。
现在你可以让链接器为该框架使用弱链接。 - 选择目标,打开其信息窗口,然后单击Build。
- 在其他链接器标记构建设置中,添加以下命令行选项规范,其中是您要弱链接到的框架的名称:
- Select the target you want to modify and reveal its build phases.
- Expand the Link Binary With Libraries build phase to view the frameworks currently linked by the target.
- If the framework you want to weakly link to is listed in the Link Binary With Libraries build phase, select it, and choose Edit > Delete to remove it. Now you can tell the linker to use weak linking for that framework.
- Select the target, open its Info window, and click Build.
- To the Other Linker Flags build setting, add the following command-line option specification, where is the name of the framework you want to weakly link to:
-weak_framework <framework_name>
- 您的产品。
这是一个docs部分。 文档
Here is a docs section for that. Docs
更具体地说,这部分。
这篇关于Xcode引用框架而不是链接二进制与库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!