Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing the source of a static library needs clean and build in xcode 4

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

like image 602
sliver Avatar asked Jun 01 '11 16:06

sliver


2 Answers

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; };

like image 57
sliver Avatar answered Oct 17 '22 04:10

sliver


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

#Force dependencies' relink
touch MyProject/main.m
like image 33
Rivera Avatar answered Oct 17 '22 03:10

Rivera