Embedded Framework conflict with version located outside the bundle
One of my Mac applications contains a framework which I embed into the application bundle. Now I have found some evidence that on some customer machines the application links against the same framework located in the /System/Library/Frameworks folder.
I'm obviously missing something when it comes to linking the embedded framework to the application in XCode, so here's how I've done it.. and perhaps you can point me to the missing step:
1) I drag the framework project into my project and set up the dependency between both projects 2) I drag the build product of the framework project to the "Link Binary with Libraries" build phase of my target 3) I drag the build product of the framework project to the "Copy Framework Files" build phase of my target set to "Destination: Frameworks"
This all works great but somewhere I need to specify that I want to link with the embedded version of the framework rather than any framework version that might be found on the system. Is there a search path to be set somewhere? or "static" link?
Any help would be appreciated.
Best regards,
Frank
Sounds like you might be missing a key step. You also need to set the "install name" of your embedded framework.
When you link a framework or dynamic library, your app will look for the framework at the path specified by framework's install name. This should specify a relative path for embedded frameworks. If it is an absolute name it will pick up the system installed version, even if you've embedded the library.
To examine the install name do the following and look at the first location.
otool -L <framework-binary>
These two blog posts explain the issue and also how to set everything up properly:
Additionally, if you're compiling a dylib from the command line (say an open source library) just add the following to your CFLAGS to set your install name.
-install_name '@rpath'
If you want to modify an existing binary's install name use 'install_name_tool'.
Also be sure your copy files build phase is copying the right files into the right places in your app bundle.
链接地址: http://www.djcxy.com/p/76408.html上一篇: 生成一个静态库