19

I have an iOS project that is built upon a framework project that we use in different iOS projects. The framework is included in the app project as an xcode project. The app project has a dependency on the framework's static library build target. (Similar to most open source libraries like three20)

The problem is that if I change something in the framework source code the static library is not rebuilt when I build&run the app project.

Doing a clean followed by a build&run the changes are compiled correctly. Doing a rebuild every time I change something in the framework is not a good fix for obvious reasons.

Is there a setting that I have to changed so that xcode is correctly identifying my framework as dirty and builds it accordingly?

I'm using xcode 4.0.2

sliver
  • 1,650
  • 2
  • 14
  • 23
  • Has the same problem. Need a clean build if i update the source of the library. Did you solved it? thanks. – jim.huang Jun 17 '11 at 08:16

3 Answers3

22

This is a bug in xcode 4.0.2 (might be fixed in future version). From https://devforums.apple.com/thread/91711?start=25&tstart=0:

  1. Set static libraries in project, under Frameworks to: Relative to Build Products
  2. Close XCode
  3. Edit project.pbxproj and remove all the path components of the static library so that only the filname remains, like this (the important part is "path = libLibrary.a")

    A74F787413566130000D0AFC /* libLibrary.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libLibrary.a; sourceTree = BUILT_PRODUCTS_DIR; };

sliver
  • 1,650
  • 2
  • 14
  • 23
1

Add a script step where you set your main.m file as modified

#Force dependencies' relink
touch MyProject/main.m
Rivera
  • 10,792
  • 3
  • 58
  • 102
0

You are possibly missing a dependency between your target and the static library.

In order to add a dependency:

  1. drag/drop the static library Xcode project on your project

    1b. add the library to your app frameworks (I understand that it's already there);

  2. select your target; show the Info pane;

  3. go to Dependencies, click on "+", then select your static lib.

These instructions are valid for Xcode 3.2.x but I hope that based on this you can easily find your way out of this with Xcode 4.

EDIT: For Xcode 4, check this and this (the edited part of the question for a workaround).

Community
  • 1
  • 1
sergio
  • 68,819
  • 11
  • 102
  • 123
  • The steps are a bit different in xcode 4. But I already did that, otherwise my project would never build without errors. The problem is not that I get errors during the build, but that the changes in the library project will not be recognized when doing a normal build. Only a clean&build will work. – sliver Jun 03 '11 at 06:46
  • If you set correctly the dependency, then I don't know what to think of. Keep in mind that only step 1 above is required to build correctly. Adding a library for linking is different that adding it also as a dependency. – sergio Jun 03 '11 at 07:06