开发者

How do I correctly modify a custom cocoa framework?

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 fr开发者_开发技巧amework.

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.


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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜