I want to manage projects in workspaces using Xcode 4 with Cocoa Touch Static Library projects which contain shared code that I could reference from other projects. According to WWDC 2010 videos and the Xcode 4 documentation there is a feature for "implicit dependencies" for workspaces in Xcode 4. I have been trying to make it work and I am not having much success.
Sample Workspace: DependenciesInXcode4.zip
You can see the very basic sample project has 2 static library projects which I named Library1 and Library2. I then have a single class in each project which I reference from the iPhone project called PrimaryApp. I get support from Code Sense when adding the import statement but the build fails.
You can see how the build fails because it cannot find the dependencies.
To resolve these issues I added manually linked the Library1 and Library2 projects.
I also had to add the path to these projects as Header Search Paths.
Now when I build both of the dependency libraries and then run PrimaryApp in the iPhone Simulator it builds successfully and runs. I have found that it does not always ensure that the dependency projects are built when necessary and this is clearly a manual process. This is not what I consider "implicit dependencies" as the Xcode videos and documentation imply that it should work. I have been looking for more concrete examples but so far I have had no luck. Even here on Stackoverflow I do not see a satisfactory answer yet.
It appears that developers are falling back to old techniques and not truly using the new "implicit dependencies" features.
I'd appreciate some help with understanding how to get "implicit dependencies" to work with workspaces in Xcode 4.
Here are my questions:
- How are "implicit dependencies" supposed to work in Xcode 4 with workspaces?
- Why can't the code in Libary1 and Library2 be found automatically in PrimaryApp?
- Are additional changes required to make dependencies work in a workspace?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…