What's the correct way to configure Xcode 4 workspaces to build dependencies when needed?

后端 未结 4 1749
滥情空心
滥情空心 2020-11-29 18:48

My case is simple, a workspace with two sibling projects: one main (iOS) app and a project that builds several static library targets used by the app.

Here\'s how I

4条回答
  •  感动是毒
    2020-11-29 19:17

    Editing the scheme (swapping around build targets, un-/check "Parallelize Build" and/or "Find Implicit Dependencies") didn't work for me. I still had to clean build the project, after any code change in the static lib. Searching the dev forums, I finally found this answer, which worked wonders.

    Make sure the Identity and Type inspector is showing and select the libWhatever.a file in your application's project (not the library). If you see Location: Relative to Project [or Relative to Group], this is your problem.

    1. Click Relative to Project and change it to Relative to Build Products.
    2. This will change the type of the link, but it will still be broken.
    3. Click the locate button and find the output file.

    Adding a static lib to an existing project via Build Phases -> Link Binary with Libraries automatically makes it "Relative to Group" (if both are siblings in the same workspace). Changing its location the way described above resolves the build dependency problem and in the project navigator your .a file should appear in black letters (instead of red).

提交回复
热议问题