Re: Quartz.framework Catch-22 on Panther
Re: Quartz.framework Catch-22 on Panther
- Subject: Re: Quartz.framework Catch-22 on Panther
- From: Nick Nallick <email@hidden>
- Date: Thu, 17 Apr 2008 08:13:59 -0600
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?
Thanks,
Nick
On Apr 11, 2008, at 5:27 PM, Nick Nallick wrote:
I'm using the Cocoa class QCRenderer after testing for Tiger or
later. This means I have to link to Quartz.framework which I do as
a weak link so I can still start under Panther and test the system
version before trying to instantiate QCRenderer. This worked fine
when building on Tiger.
Unfortunately I've found that when building on Leopard all I have to
do to crash Cocoa on Panther is add "-weak_framework Quartz" to
Xcode's "Other Linker Flags". It's not even necessary to add
Quartz.framework to my project. When this linker flag is added the
following code will crash on Panther on the second line, although it
seems just about any reference into Cocoa will crash (e.g., @try
will do it).
NSApplicationLoad();
[NSAutoreleasePool alloc];
Therefore I can't link or weak link my application to
Quartz.framework. Is there any way to instantiate QCRenderer
without doing that?
I guess I could create a private framework to instantiate QCRenderer
and only load it on Tiger and later, but it seems like there ought
to be an easier way in Obj-C.
Thanks
Nick Nallick
_______________________________________________
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