Re: The best way to call Cocoa methods not implemented in previous versions of the SDK?
Re: The best way to call Cocoa methods not implemented in previous versions of the SDK?
- Subject: Re: The best way to call Cocoa methods not implemented in previous versions of the SDK?
- From: Jens Alfke <email@hidden>
- Date: Tue, 06 Sep 2011 11:47:33 -0700
On Sep 6, 2011, at 10:43 AM, Quincey Morris wrote:
> If so, that sounds like a terrible idea. It forces you to write your own "fake" (subset of the) 10.7 SDK, which is a terrible idea (and probably not supported), and it links your app agains the 10.6 libraries, which is a terrible idea (in relation to its 10.7 behavior).
I disagree. This is done all the time; for instance, as of June, Google Chrome/Chromium still builds using the 10.5 SDK, but has code to call new methods in 10.6 and 10.7. If your app is primarily written for the old OS but wants to add a few new behaviors for the new one, I think this is the right way to go. When moving to fully adopt the new OS, of course you should switch to using its SDK.
Linking against the 10.6 libraries is the correct behavior if the app hasn’t been fully updated to use 10.7 features/behaviors. There are a lot of cases where a system framework will change its behavior based on which version the app linked against, as a backward-compatibility measure. For this reason, changing the SDK setting in Xcode can often set you up for a lot more work than you’d intended, as it can break your app until you update your code accordingly.
(If you want an example: starting in 10.5, AppKit started tracking ref-counts of NSFont objects. Before that there was a bug in which they were never dealloced. Unfortunately there were apps that kept NSFont instances around without retaining them. To keep these apps from crashing on 10.5, NSFont would keep the old always-retained behavior for apps linked against the 10.4 SDK, but not the 10.5 SDK. This was called out in the release notes, but who reads every line of the release notes? So some developers found out by seeing their apps start to crash after they innocently changed the SDK setting from 10.4 to 10.5.)
—Jens_______________________________________________
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