views:

439

answers:

2

I've written a simple screensaver that loads a Quartz animation using a QCView. But when I install it on Snow Leopard it appears in the Screen Saver preview with a message saying "You cannot use XXX screensaver on this computer...". If I comment out the loadCompositionFromFile line (but leave the Quartz framework linked) it's fine. I can also use the Quartz animation by itself as a screensaver just fine. So it's something about loading the qtz file into a QCView that is a problem. Any thoughts would be appreciated.

thanks, Pat

A: 

My guess is that a 32-bit binary is being fed to a 64-bit process or vice-versa.

Azeem.Butt
Yes, but my screensaver is being compiled as a 64bit target and it runs fine without the quartz animation. I looked around but didn't see any options on Quartz Composer for outputting QTZ files...
Pat Niemeyer
And you've already tried compiling it for 32-bit addressing as well?
Azeem.Butt
Well, I'm not intimately familiar with XCode, but I have tried doing clean builds of the screen saver after selecting each of i386 and x86_64 as the "Active Architecture". I haven't delved into the build settings much beyond that. I did look in the /Library/System/Frameworks to see if there were different versions of the Quartz Framework for linking... but I see only one.Just to reiterate also - the screensaver runs ok if I don't load the QTZ file into the QCView. And the QTZ file runs by itself as a screensaver just fine... So this is weird.thanks.
Pat Niemeyer
Maybe try something simpler for your first project.
Azeem.Butt
a) little snarky? :) b) What I meant was that I am not intimately familiar with every obj-c build option, framework linkage issue, and Snow Leopard quirk, (are you?) c) This is actually exactly the kind of project a novice might attempt... It's about 3 lines of code added to the template ScreenSaver project that XCode produced. It's obviously some kind of issue linking with Quartz, which seemed like a valid question and couldn't be terribly obvious because as yet it's still unanswered :)
Pat Niemeyer
+1  A: 

Are you building with GC unsupported? The screen saver engine runs garbage-collected when running in 64-bit on Snow Leopard.

See QA1666 for the full set of requirements.

Note that even if you only support Snow Leopard, you should still build 32-bit GC-supported or -unsupported (not -required) in a non-release build configuration if you want to use test apps like SaverLab.

Also, is there a reason you're hosting a Quartz Composition in a QCView? The screen saver can handle Quartz Compositions directly.

Peter Hosey
I am building for 64bit arch only and have set objc gc to "required"... but apparently it's not my code that is causing the error, it's the quartz code that it's linked with. The "You cannot use..." message that I get does not appear upon loading the screensaver as shown in that document, but only as text on the screen in the preview... apparently it decides this after the screensaver has started to execute and it tries to load the QTZ file. (It is an identical message but in my case shows only in the preview after running, not a drop down message preventing you from loading / selecting).
Pat Niemeyer
I can reproduce the problem that document discusses by setting obj-c GC to unsupported and then I get that drop down message on loading my saver. So I think this unfortunately has nothing to do with how I'm compiling my code, but something about linking with Quartz or how my QTZ file was produced...
Pat Niemeyer
In answer to your question, the reason I'm using the screensaver API is because I want to launch an application on exit from the screensaver. It's just a simple wrapper around the QCView with this exit hook. And yes, I realize there is a notification for screen saver exit but I wanted this to be easily installed by end users (not have to run a daemon). Thanks.
Pat Niemeyer