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: Mike Abdullah <email@hidden>
- Date: Tue, 06 Sep 2011 11:42:25 +0100
You're supposed to in such circumstances set your Deployment Target to 10.6, but SDK to 10.7. That will allow you to use new methods without warnings, but ship on 10.6.
performSelector really isn't cumbersome at all:
[window performSelector:@selector(setRestorationClass:) withObject:someClass];
On 6 Sep 2011, at 11:33, Oleg Krupnov wrote:
> Hi,
>
> 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];
> }
>
> however, because I compile for Snow Leopard, the compiler will still
> give me a warning that the setRestorationClass: method is not defined.
>
> How do I work around this, other than using [NSObject
> performSelector:withObject:...], which looks too cumbersome, and other
> than deriving all windows from a base class that will define this
> method? Extensions are not suitable either, because there is no way to
> call super from them. Any other ideas?
>
> Thanks.
> _______________________________________________
>
> 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
_______________________________________________
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