Re: private frameworks
Re: private frameworks
- Subject: Re: private frameworks
- From: Greg Herlihy <email@hidden>
- Date: Tue, 01 Nov 2005 08:55:05 -0800
- Thread-topic: private frameworks
On 11/1/05 1:12 AM, "Niko Matsakis" <email@hidden> wrote:
> I have a utility Framework I have developed that I wish to include in
> an application of mine as a private framework. I have read the
> "Framework Programming Guide" and tried tof follow its directions but
> they don't seem to work.
>
> I did deviate from the guide in one respect: it recommends adding the
> Framework's source into your application project: this strikes me as
> a good idea if this framework is only used by one application, but if
> it is used by many then it makes more sense to have a separate
> project for the Framework itself. If this is wrong, let me know, but
> it seems like otherwise there will be configuration for the same
> framework duplicated among many different projects.
It is necessary to add the Framework itself to any project that needs it.
And the location of that Framework is significant.
> Anyhow, what I tried eventually is to add a "copy files" step to my
> project which copies the referenced Oaxaca.framework into the
> Frameworks directory of the application. I have verified in Terminal
> that the file is present. This seems to be what the Framework
> Programming Guide suggested, although they said to do it via the
> "install path" from the framework target. As the framework target is
> not in my project, I thought I'd try a different route.
When a mach-o application is built, the paths of all the Frameworks that it
needs are recorded in the application. Upon every launch, an application
will search for necessary Frameworks at those recorded locations. The
application will not look elsewhere (under normal circumstances). So the
Framework's path as specified in the project must lead to that Framework
when the application's bundle is completely assembled.
Paths come in two main varieties. The first is absolute:
/System/Library/Frameworks/Foundation.framework
Absolute paths are useful when specifying the location of system frameworks,
but cannot reliably locate a private framework that resides in the
application bundle. For a private framework, a relative path can be used:
@executable_path/../Frameworks/MyPrivateFramework.framework
The latter format is no doubt the one to use in this situation.
In summary: I would place the private framework at a location this is fixed
relative to the location of the application itself. I would then use a
relative path (much like the example above) to specify in the project the
private framework's location vis-à-vis the application. And I would consult
Xcode's documentation for more detailed information.
Greg
> Unfortunately, it doesn't work. Any advice?
>
> What I don't want is for users to have to install the Framework
> separately from the Application. I definitely want the Application
> to be self contained.
>
>
> Niko
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden