The best way to call Cocoa methods not implemented in previous versions of the SDK?
The best way to call Cocoa methods not implemented in previous versions of the SDK?
- Subject: The best way to call Cocoa methods not implemented in previous versions of the SDK?
- From: Oleg Krupnov <email@hidden>
- Date: Tue, 06 Sep 2011 13:33:13 +0300
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