如何在不创建 Umbrella 框架的情况下构建一个依赖于另一个框架的 iOS 框架 [英] How to build an iOS Framework with a dependency on another without creating an Umbrella Framework

查看:26
本文介绍了如何在不创建 Umbrella 框架的情况下构建一个依赖于另一个框架的 iOS 框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过创建一些可重复使用的框架来简化我的开发,这些框架包含我在多个项目中经常重复使用的功能.

I am trying to streamline my development by creating some re-usable Frameworks which incorporate features I commonly re-use in multiple projects.

但是,在设置我的一个框架后,我遇到了一个问题,这些类依赖于 Firebase 框架.阅读 Apple 文档后,不建议创建 Umbrella 框架(嵌入另一个框架),尤其是如果您没有嵌入式框架的所有权(我没有).

However, having setup one of my Frameworks I have encountered a problem, the classes have a dependency on the Firebase framework. Having read the Apple docs it's not recommended to create an Umbrella Framework (one which embeds another) especially if you do not have ownership of the embedded Framework (which I do not).

所以问题是:

我如何创建一个框架项目,它允许我构建框架而不包括创建伞框架的依赖项.我想这就是像 Firebase 这样的人所做的,因为当您添加他们的框架时,您还必须将其他框架添加到您的项目中.我不太明白您将如何配置项目以允许您构建框架而不会出现错误但不包含依赖项.

How can I create a Framework project which allows me to build the Framework without including the dependencies which would create an Umbrella Framework. I presume this is what people like Firebase do because when you add their Framework there are others you have to add to your project as well. I can't quite see how you would configure a project to allow you to build the Framework without errors but not include the dependencies.

作为参考,我使用的是最新的 Xcode,需要支持 iOS 8 及更高版本.

For reference I am using the latest Xcode and need to support iOS 8 and above.

提前感谢您对此的任何想法/建议

Thanks in advance for any thoughts / suggestions on this

推荐答案

为了任何在同一问题上苦苦挣扎的人的利益,答案比我预期的要简单得多.

For the benefit of anyone who is struggling with the same issue, the answer is much simpler than I had anticipated.

框架是动态链接的,只需将框架添加到您自己的框架的项目中,不会导致它嵌入到输出文件中,因此不会生成 Umbrella 框架.你实际上不需要做任何事情.您自己的框架所需的任何框架都可以包含在您的项目中,以便您可以编译自己的框架,并且还需要包含在使用您的框架的任何项目中.

The Frameworks are linked dynamically and simply adding a Framework to the project for your own framework will not cause it to be embedded in the output file and therefore not generate an Umbrella Framework. You don't actually need to do anything. Any Frameworks that are required by your own Framework can be included in your project so that you can compile your own Framework, and will also need to be included in any projects that utilise your Framework.

这篇关于如何在不创建 Umbrella 框架的情况下构建一个依赖于另一个框架的 iOS 框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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