相互依赖的框架Xcode [英] Interdependent frameworks Xcode

查看:158
本文介绍了相互依赖的框架Xcode的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一组(仅供内部使用)框架,这些框架封装了开发过程中的各种元素.其中一些框架相互依赖,但我想将它们分开以使其更易于管理.我现在遇到各种编译器错误,我认为与依赖项重叠有关.

目前,所有这些框架和一个应用程序都与不同项目共享同一工作区.如何在这种情况下配置我的应用程序和框架以进行编译?

这是个简单的主意:

应用依赖项: A.框架B.框架C.框架D.框架

A.framework依赖

B.framework依赖项 A.framework

C.framework依赖

D.framework依赖

更多信息:

当前,在C.framework中,我已将A和B.frameworks拖动到"Frameworks"文件夹中.我在其他地方读过,做到了与库的 not 链接二进制文件.无论哪种方式,我都会在A和B.framework的标头中遇到某些函数的编译器错误:

ld: symbol(s) not found for architecture armv7

A&的构建设置B将仅建立活动架构"设置为否",并将有效架构设置为包括"armv7".

B.framework,但是没有问题.

更新:

我现在可以通过在每个目标中链接二进制文件来构建该应用程序……但是它立即因该错误而崩溃:

dyld: Library not loaded: @rpath/A.framework/A
  Referenced from: /var/containers/Bundle/Application/94488FD7-B731-4E6B-86E6-3D2F09BB4E04/App.app/App
  Reason: image not found

解决方案

好,所以我似乎已经通过以下方式克服了这一点.

我没有让我的工作区将每个框架都作为一个单独的顶层"项目,而是将框架项目移到了App项目的子项目中.

然后,我将每个框架添加到应用程序的嵌入框架"部分(并能够从链接二进制.."和目标依赖项"部分中将其删除.

在每个框架中,我都使用链接二进制..."部分来包含从属框架.

我不确定我理解所有这些原因的原因,但至少我可以继续前进!

感谢@ vel-genov的帮助!

I'm working on a set of (internal use only) frameworks that encapsulate various elements of my development process. Some of these frameworks are dependent on one another, but I'd like to keep them separate so as to be more manageable. I'm running into various compiler errors now which I think have to do with the dependencies overlapping.

At the moment all of these frameworks and an app share the same workspace as different projects. How can I configure my app and frameworks to compile in this situation?

Here's the boiled down idea:

App dependencies: A.framework B.framework C.framework D.framework

A.framework dependencies none

B.framework dependencies A.framework

C.framework dependencies A.framework B.framework

D.framework dependencies none

More info:

Currently, in C.framework, I have dragged A and B.frameworks into the "Frameworks" folder. I read elsewhere to do that an to not Link Binary With Libraries. Either way, I get a compiler error for some functions that are in the headers of both A and B.framework:

ld: symbol(s) not found for architecture armv7

The build settings for A & B have "Build Active Architectures Only" set to NO and valid architectures set to include "armv7".

B.framework, however has no issue building.

Update :

I'm now able to get the App to build, by Linking Binaries in each of the targets... however it immediately crashed with this error :

dyld: Library not loaded: @rpath/A.framework/A
  Referenced from: /var/containers/Bundle/Application/94488FD7-B731-4E6B-86E6-3D2F09BB4E04/App.app/App
  Reason: image not found

解决方案

Ok, so I seem to have gotten past this in the following way.

Instead of having my workspace have each framework as a separate "top-level" project, I moved the framework projects into sub projects of the App project.

Then, I added each framework to the App's "Embed Frameworks" section (and was able to remove it from "Link Binary.." and "Target Dependencies" sections.

Within each framework, I used the "Link Binary..." section to include the dependent frameworks.

I'm not sure that I understand all the pieces to why this works, but at least I can move on!

Thanks @vel-genov for your help!

这篇关于相互依赖的框架Xcode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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