Using deprecated methods
Using deprecated methods
- Subject: Using deprecated methods
- From: Keith Blount <email@hidden>
- Date: Sat, 5 Jul 2008 05:08:45 -0700 (PDT)
Hi,
Something that has bothered me for ages in Cocoa, but which I've always put to one side, is how to handle certain deprecated methods when supporting more than one OS. In some instances it's as simple as checking at runtime which OS is being used and using the appropriate method accordingly, but I'm wondering here about the trickier instances. For instance:
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.
Sorry if this question is a little dumb to those of you experienced in maintaining apps over several OS releases; I would be very grateful for your advice, though.
Many thanks in advance and all the best,
Keith
_______________________________________________
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