Xcode4 Workspace with Static library project & application project
I'm working on a project where I'm going to eventually have a library of code that will be used by multiple applications. In reading though the documentation it sounded like creating an XCode4 workspace and 2 p开发者_Python百科rojects (1 library, and 1 application) was the way to go.
I did this and everything appeared to be working just great. However, today I did a bunch of work on my library project and when I run my application to test my library changes it appears to always be including an older compiled version. I'm at a loss, I added my library as a build target in my applications scheme and XCode tells me it's compiling the library, but its always linking to an old version.
Any help is greatly appreciated. Am I missing something in how I set my workspace up? Is there a build step that will force linking to my newly compiled .a? I've even tried removing the dependency, cleaning, re-adding the dependency and building my app and I still get the same results.
I ran into same problem and my solution was to add
rm -f BUILT_PRODUCTS_DIR/$EXECUTABLE_PATH
to the build -> pre-actions
section (edit scheme, expand build and add pre-action).
Under Provide build settings from
make sure to select your target project.
This will ensure correct env vars are configured when your script runs.
I'm using XCode 4.5.1.
Turns out XCode was doing everything right, and I wasn't. Another clean all and recompile and everything is working as expected.
Additional information about this type of issue here: Static libraries in Xcode 4
精彩评论