Search code examples
iosxcodexcode4static-libraries

Trouble Creating Cross Project Reference for Xcode 4


I'm trying to pick up some better code organization practices. Over time, I've developed a collection of utility-type files that I import into all of my iOS projects. Rather than continuing to copy them in, I want to setup a separate "Library" project which builds these files to a static library. Then, I reference the static library in my app's project.

In Xcode 4.2 I created a new project "JTLibrary" with a static library as the target, added some files, and it builds as expected.

Now, I created a new project "LibraryTest" which should behave like any other app project I might be working on. My understanding was that I should be able to drag the JTLibrary project into this project to create a cross project reference. Once that was done, I would link LibraryTest's binary against the static library from JTLibrary.

However, when I drag the JTLibary project into the LibraryTest project, it does not appear expandable. I expected I should be able to see the files in it, etc. See screenshot below:

enter image description here

Can anyone offer some insight to why the project appears like this rather than expandable? Once it is expandable, I should be able to see the static library in the app's project.

Thanks!

EDIT 11/7

It's worth mentioning that I'm working with a VERY basic project now. From the new project window, select Framework & Library >> Cocoa Touch Static Library. Add one function to the default class and build.

I can copy the header and .a files into another project and use them successfully, but if I try to drag the project itself, it appears like the picture above.


Solution

  • To create a subproject simply drag a project node from Finder into Xcode.

    DO NOT open two Xcode instances and drag the project node from one to the other (that's why the subproject is not expandable).