Xcode Creating Universal Frameworks as Dependents of a Universal Framework

你。 提交于 2019-11-27 08:39:17

问题


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.


回答1:


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!!! :-)



来源:https://stackoverflow.com/questions/25191681/xcode-creating-universal-frameworks-as-dependents-of-a-universal-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!