Embedding a framework within an app

Christiaan Hofman cmhofman at gmail.com
Wed Apr 2 07:42:08 PDT 2008


On 2 Apr 2008, at 3:59 PM, Mark de Jong wrote:

> Hi!
>
> I seem to be missing some basic "point" about embedding a framework  
> within an application.
>
> I have built a framework in one project and an application in  
> another project. Up until now, I have simply been installing the  
> framework at "/Library/Frameworks" and then my application has used  
> the framework and all is well.
>
> Now, I'd like to embed the framework within my application.
>
> I have read all of Apple's docs on how to do this. Changed the  
> framework's "Install Directory" (INSTALL_PATH) to be  
> "@executable_path/../Frameworks" and have been sure to place a copy  
> of the framework within the application's bundle at "MyApp.app/ 
> Contents/Frameworks" using a "Copy" build phase, as instructed in  
> the docs.
>
> I have added the framework project to the application's project and  
> pointed the build directory of the framework to the application's  
> build directory. I made the framework "Product" a dependency of the  
> app's project.
>
> The application still cannot find the framework.
>
> Using "otool -L" on both the application binary and the framework  
> binary, they both show "/Library/Frameworks" as my framework's  
> location.
>
> I know I'm just being boneheaded and am missing something basic or  
> obvious.
>
> Would some kind soul please point out the error of my ways to me? :-)
>
> Thanks,
>
> 	-- Mark

I can't tell you, but apparently you haven't done exactly what you  
said here. Have you used otool on the actual build product of the  
framework? If you really set the INSTALL_PATH to what you said that's  
what otool -L should give. You may have copied an old version of the  
framework into your app bundle? The way we are making sure build  
products like frameworks are found is to use a shared build products  
directory for all the projects. That's much easier and more reliable  
than hard coding the (relative) path to the build framework from your  
app.

Christiaan



More information about the MacOSX-dev mailing list