Xcode Creating Universal Frameworks as Dependents of a Universal Framework

654 views Asked by At

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:

Project Structure

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.

enter image description here

  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.

enter image description here enter image description here

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.

enter image description here

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:

Workspace example

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

There are 1 answers

2
Patricia On

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