简体   繁体   English

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

[英]How to add xcode framework from external folder?

We have two different apps : one for iPhone, and one for iPad, which are not linked using workspace.我们有两种不同的应用程序:一种用于 iPhone,一种用于 iPad,它们不使用工作区链接。 So, think of them as being in two different unlinked folders.因此,可以将它们视为位于两个不同的未链接文件夹中。

Now, I have created an iOS framework ( Cocoa Touch Framework ) which I want to include it in both iPhone and iPad.现在,我创建了一个 iOS 框架( Cocoa Touch Framework ),我想将它包含在 iPhone 和 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 ie to "Add Target Dependencies", this framework is not shown.因此,根据我遇到的教程,我在 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.提前致谢。

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。

在此处输入图片说明

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.基于这两个设置,您可以链接项目外部的外部框架。

Add the custom framework in the Embedded Binaries as following picture.Embedded Binaries添加custom framework ,如下图所示。 Because it is not a system framework, it needs to be copied into the application bundle.因为它不是系统框架,所以需要复制到应用程序包中。

About embedded binaries:关于嵌入式二进制文件:

图片

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

  1. Add external framework添加外部框架

  2. Build Settings > Framework Search Paths构建设置 > 框架搜索路径

  3. Find the related path and update it with "recursive"找到相关路径并用“递归”更新

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM