如何从外部文件夹添加 xcode 框架?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35148873/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 08:29:37  来源:igfitidea点击:

How to add xcode framework from external folder?

iosobjective-ciphonexcodeipad

提问by Shubham Aggarwal

We have two different apps : one for iPhone, and one for iPad, which are not linked using workspace. So, think of them as being in two different unlinked folders.

我们有两种不同的应用程序:一种用于 iPhone,一种用于 iPad,它们不使用工作区链接。因此,将它们视为位于两个不同的未链接文件夹中。

Now, I have created an iOS framework (Cocoa Touch Framework) which I want to include it in both iPhone and iPad. So, as per tutorials I encountered, I created a reference to the Xcode-Project file of framework in the iOS App project, but when I follow the next step i.e. to "Add Target Dependencies", this framework is not shown.

现在,我创建了一个 iOS 框架(Cocoa Touch Framework),我想将它包含在 iPhone 和 iPad 中。因此,根据我遇到的教程,我在 iOS App 项目中创建了对框架的 Xcode-Project 文件的引用,但是当我按照下一步即“添加目标依赖项”进行操作时,该框架并未显示。

I don't know how to proceed. I want to include the framework to both without creating further copies of Framework.

我不知道如何继续。我想在不创建框架的进一步副本的情况下将框架包含在两者中。

Thanks in Advance.

提前致谢。

回答by BADRI

Target>Project>Build Phase>Link Binary with Libraries>Add items(+)>Add Others>Path to external framework.

Target>Project>Build Phase>Link Binary with Libraries>Add items(+)>Add Others>Path to external framework。

enter image description here

在此处输入图片说明

回答by AechoLiu

Add the custom frameworkin the Embedded Binariesas following picture. Because it is not a system framework, it needs to be copied into the application bundle.

添加custom frameworkEmbedded Binaries,如下图。因为它不是系统框架,所以需要复制到应用程序包中。

About embedded binaries:

关于嵌入式二进制文件:

The image

图片

回答by Victor Choy

I add more information. Make sure that:

我添加了更多信息。确保:

1 Target>Project>Build Phase>Link Binary with Libraries>Add items(+)>Add Others>Path to external framework.

1 Target>Project>Build Phase>Link Binary with Libraries>Add items(+)>Add Others>Path to external framework。

2 Build settings > Framework Search Paths > add the framework parent path

2 Build settings > Framework Search Paths > 添加框架父路径

Based on the two setting , you can link the external framework outside project.

基于这两个设置,您可以链接项目外部的外部框架。

回答by kakyo

Adding to @AechoLiu's answer, with Xcode 11.1, I had to set the Framework's Embedcolumn to Embed & Sign, otherwise the Framework won't be bundled.

添加到@AechoLiu 的答案,使用 Xcode 11.1,我必须将 Framework 的Embed列设置为Embed & Sign,否则将不会捆绑 Framework。