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: Chris Hanson <email@hidden>
- Date: Tue, 06 Sep 2011 16:31:35 -0700
On Sep 6, 2011, at 3:33 AM, Oleg Krupnov wrote:
> I'm implementing a new Lion's API, namely the resume. I need to make
> the following call:
>
> [window setRestorationClass:someClass];
>
> I'd like my app to also work on Snow Leopard, so I do this:
>
> if ([window respondsToSelector:@selector(setRestorationClass:)])
> {
> [window setRestorationClass:someClass];
> }
It may be better to actually check whether your code is running on Snow Leopard rather than make -respondsToSelector: checks.
> however, because I compile for Snow Leopard, the compiler will still
> give me a warning that the setRestorationClass: method is not defined.
What do you mean "compile for Snow Leopard"? You should set your Base SDK to the most recent OS whose features you are going to use (in this case 10.7) and set your Deployment Target to the least recent OS you want to run on (in this case 10.6).
Furthermore, Xcode 3.2.6 and 4.0 added "Latest Mac OS X" and "Latest iOS" options to the Base SDK pop-up, which is preferable to specifying a particular OS version for the SDK against which you wish to build.
-- Chris
_______________________________________________
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