Xcode 创建通用框架作为通用框架的依赖项 [英] Xcode Creating Universal Frameworks as Dependents of a Universal Framework

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

问题描述

目前,当我分发我的通用框架时,我必须分发我的通用框架包含在构建阶段 - 将二进制文件与库链接.我想将所有内容都捆绑到一个整洁的通用框架中,这样我的用户就可以轻松链接到我的通用框架,而无需打扰其他框架.

我正在尝试将另外两个通用框架嵌入"到我的通用框架中.我在这里关注本教程:,但构建开始失败.我已经取消了该更改,并且构建再次运行.

我将继续坚持下去,但我很想听听已经这样做并让它发挥作用的人的意见.

解决方案

我最终选择了第一个选项,将通用框架嵌入到主通用框架中.我一直在使用我上面提到的教程(https://github.com/jverkoey/iOS-Framework).这并不容易,但经过几天和多次工作后,我终于掌握了它并让它工作.

Jeff Verkoeyen 的精彩教程!

我创建的唯一区别是我没有将嵌入式框架放在应用程序中.相反,我将它们放在另一个通用框架中.当我尝试在应用程序中使用它时,我必须进行一些细微的调整才能使其正常工作.但它奏效了!!! :-)

Currently, when I distribute my Universal Framework I have to distribute the Universal Frameworks mine includes in the Build Phases - Link Binary With Libraries. I want to bundle everything up into one tidy Universal Framework, so my users will be able to easily link to my Universal Framework and not need to bother with the others.

I am trying to "embed" two other Universal Frameworks into my Universal Framework. I'm following this tutorial here: Developing the Framework as a Dependent Project

Here is a picture of my project structure. Notice the two projects under Frameworks:

I have added the Project Targets to the Target Dependencies and I've linked the .a files in Link Binary With Libraries. I am able to build the dependent projects with no errors.

  1. When I try to build the my main Universal Framework, the first problem I encounter is that it cannot find a Header file that I have added to the Build Phases - Copy Files section. However, I did add them to the Aggregate target and not to the Project target, which is the way the other dependent project is configured and it seems to have no problem with Headers.

It's possible that if I fix that issue the main Universal Framework might produce the correct output. Right now, it is not producing the expected Products (Debug-iphoneos, Debug-iphonesimulator, and Debug-iphoneuniversal). See more comments below.

You can see that the Products include only the Debug-iphoneos and the .frameworks are not listed there but the .a library files are.


EDIT: NEW DIRECTION

I'm torn here. In the above code, the instructions show you how to add dependent Frameworks to the Frameworks folder of your project. But upon further reading I see where some folks create a Workspace and add the dependent projects at the same level as the main project, as shown here:

I've managed to get all three projects to build, but the configuration is so brittle. I attempted to make a change to point to a common folder for the Header files as described in these instructions but the build started to fail. I've backed out that change and the build is working again.

I'm going to continue soldiering on with this but I would love to hear from someone who has already done this and gotten it to work.

解决方案

I ended up going with the first option, embedding the Universal Frameworks into a main Universal Framework. I kept working with the tutorial that I mentioned above (https://github.com/jverkoey/iOS-Framework). It wasn't easy but after working on it for a few days and multiple times, I finally got the hang of it and got it working.

Great Tutorial by Jeff Verkoeyen!

The only difference for what I was creating is I didn't put the embedded frameworks in an application. Rather, I put them inside of another Universal Framework. When I tried using it in an application, there were some minor adjustments I had to make it work. BUT IT WORKED!!! :-)

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

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