Search code examples
xcodemacosxcode4frameworksbuild

How to add Private Framework to Target Dependencies?


I'm trying to embed a private framework (last paragraph) in my application bundle using XCode 4 and following Apple's (seemingly) outdated instructions.

In my case, I'm Using Separate Xcode Projects For Each Target. This is the final step:

In the General tab of the inspector window, add your framework as a dependency for the application. Adding this dependency causes Xcode to build the framework target before building the application target.

The build dependency you establish in the application target causes the framework to be built before the application. This is important because it guarantees that a built version of your framework will be available to link against and to embed in the application. Because of this dependency, you can set the active target of your Xcode project to your application and leave it there. Building the application now builds the framework and copies it to the application bundle directory, creating the necessary linkage between the two.

Yet, when in click on the + button in Target Dependencies the framework doesn't show up. How can I establish a build dependency between the private framework and the application target in Xcode 4?

Edit: I should clarify that I already got the private framework working. I just want to avoid having cleaning the project every time a change to the framework is made, and make sure the framework is built before the application target.


Solution

  • Managed to solve this by adding the private framework project as a subproject, then adding the framework target in Target Dependencies.

    However, in my case the framework target didn't show as an option in Target Dependencies until I deleted DerivedData. That nasty little bug drove me crazy.