Re: Quartz.framework Catch-22 on Panther
Re: Quartz.framework Catch-22 on Panther
- Subject: Re: Quartz.framework Catch-22 on Panther
- From: "Michael Ash" <email@hidden>
- Date: Thu, 17 Apr 2008 22:10:58 -0400
On Thu, Apr 17, 2008 at 10:13 AM, Nick Nallick <email@hidden> wrote:
> I've been able to solve my problem by taking Quartz.framework out of my
> project and loading QuartzComposer.framework directly at runtime with
> NSBundle. For example:
>
> Instead of:
>
> QCRenderer* renderer = [QCRenderer alloc];
>
> I have:
>
> static Class QCRendererClass = nil;
> if (!QCRendererClass)
> {
> NSBundle* QuartzComposerBundle = [NSBundle
> bundleWithPath:@"/System/Library/Frameworks/Quartz.framework/Versions/A/Frameworks/QuartzComposer.framework"];
> QCRendererClass = [QuartzComposerBundle
> classNamed:@"QCRenderer"];
> }
>
> QCRenderer* renderer = [QCRendererClass alloc];
>
> In other words, I've had to replace a link to the Quartz umbrella framework
> with the direct loading of the QuartzComposer framework because a weak link
> to Quartz.framework is incompatible with Panther and in Tiger and Leopard
> the NSBundle for Quartz.framework can't find the class QCRenderer. I
> suppose by specifying a subframework path I'm sacrificing some uncertain
> future compatibility for backward compatibility with Panther.
>
> Is there a better way to do this? For example, can I avoid including the
> framework path, or should I also be loading the enclosing umbrella
> framework?
It is my understanding, which may be incorrect, that the enclosed
frameworks of an umbrella framework are something of an implementation
detail and should not be touched, inhaled, or looked at. The best way
to do this in a supported fashion would be to load Quartz.framework
(which you can probably just link against directly, but load it
dynamically with its path otherwise) and then use NSClassFromString to
get the classes you need. Loading Quartz.framework will get all of the
junk it contains, and then NSClassFromString will let you get a
reference to the class without needing a reference to the bundle it's
in.
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden