views:

28

answers:

1

Hello,

I'm working with the very-useful ID3 framework in my cocoa project. There's one tiny thing I'd like to modify in it, but I can't seem to get the changes I've made to apply to the built framework.

The source code provided with the framework comes with an Xcode project, so I've opened that up and for testings sake put an NSLog(@"hello"); in. It's definetly in a place where it will be called and there are other NSLog() calls in the framework that show up so it's not just console output being supressed.

To build the framework once modified I've first cleaned the build folder, made sure that it's actually removed the files, and then built it. Then in the Xcode project I'm using the framework in, I've deleted the old reference and added a new one to the framework that's freshly built. Running my project with the newly build framework doesn't call the modified framework code. I've tried with both the Development and Deployment builds that are part of the framework Xcode project.

My gut instinct is that the executable that the framework code is compiled into is being cached somehow. But as I'm fairly unfamiliar with the workings of frameworks, I'm not really sure where to look.

+1  A: 

There’s no caching for executables or frameworks in Mac OS X. To debug what’s going on, there are a couple of helpful tricks:

Use otool -L <path_to_your_executable> on the command line, to find out about the load commands (which load the libraries and frameworks into your executable). Try to find the ID3 framework and check the path. If it starts with @executable_path, the framework must be copied into your executable’s wrapper.

To really see what libraries are loaded and from where, set the environment variable DYLD_PRINT_LIBRARIES to YES. You can either do that from within Xcode (in your executables settings) or from the terminal.

You will see the libraries and their paths as they are loaded by dyld.

My gut feeling is that your executable still loads an old framework from your executable’s app wrapper or some other place where it might be installed. Try to clean your project (the one that uses the framework, not the framework itself).

Nikolai Ruhe
Right, I couldn't get otool to work for some reason, but DYLD_PRINT_LIBRARIES was very useful and showed that it was being loaded from Library/Frameworks/. It seems to insist on being in there (i.e. if I delete it from there it won't compile), but I can simply copy the new builds of the framework there and it works fine. Thank you very much.
Septih
The reason why it wants to load the framework from there is that it is the frameworks `INSTALL_PATH` build setting. Using `otool -L /Library/Frameworks/ID3.framework/ID3` should show you the frameworks installation path (the first line the output). You don’t always have to copy the framework there, you can use the one in your frameworks build directory. To allow your main executable to load this framework, there’s another environment variable: `DYLD_FRAMEWORK_PATH`. See `man dyld`
Nikolai Ruhe