Many thanks for your reply, much appreciated. Where can I find information on 
creating bundles and linking them only against a certain OS? I'm obviously 
using the wrong search terms in both the docs and in Cocoa-dev... Under the 
NSBundle documentation it explains how to get a class out of an existing bundle 
using -principleClass, but I can't see how to turn a class into a bundle, or 
how to link the bundle specifically against Leopard, for instance... Is there 
an example of how to do this somewhere?
Many thanks again and all the best,
Keith

----- Original Message ----
From: David Duncan <[EMAIL PROTECTED]>
To: Keith Blount <[EMAIL PROTECTED]>
Cc: cocoa-dev@lists.apple.com
Sent: Saturday, July 5, 2008 2:17:32 PM
Subject: Re: Using deprecated methods

On Jul 5, 2008, at 5:08 AM, Keith Blount wrote:

> I am currently overhauling printing in my application. I have a page  
> layout accessory view and I now also want to add a print panel  
> accessory view. My app runs on both Tiger and Leopard. - 
> setAccessoryView: works on both Tiger and Leopard, for adding an  
> accessory view to both NSPageLayout and NSPrintPanel. However, in  
> both cases, -setAccessoryView: was (rather frustratingly in this  
> case, I feel, as it worked fine) informally deprecated on Leopard.  
> Instead, we are advised to use -addAccessoryViewController:, which  
> uses an NSViewController. But the NSViewController class doesn't  
> even exist on Tiger, so subclassing it and having it in the project  
> will cause the app not to run on Tiger at all. I don't want a  
> different build for both Tiger and Leopard, of course, So, what is  
> the proper way of handling this? The path of least resistance is to  
> use -setAccessoryView: and hope it doesn't get formally deprecated  
> on Snow Leopard, and continues to work for a while
> despite its deprecated status. But that obviously isn't the *best*  
> (or correct) way of doing things. Any alternative is going to be  
> more complicated and involve having separate elements of code for  
> Tiger and Leopard, which isn't ideal, but I would love to know the  
> established way of handling this.


To handle a case like this, you are going to have to create a bundle  
that you link against the 10.5 SDK and only load there. This bundle  
will contain your NSViewController subclass and allow you to  
conditionally call -setAccessoryView: on 10.4 and - 
addAccessoryViewController: on 10.5. This is a general pattern that  
you can use when you want to provide alternate functionality where it  
is a requirement to subclass and that subclass only exists on a newer  
version of the OS.

As for -setAccessoryView: (and other deprecated methods) there really  
isn't a case of formal vs informal deprecation - deprecated is  
deprecated. In this particular case, using -setAccessoryView: for  
example will disable the inline print preview, so you'll want to avoid  
calling it on 10.5.
--
David Duncan
Apple DTS Animation and Printing
[EMAIL PROTECTED]


      
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to